dtrim
A tool for trimming deep/lenghty javascript structures. Some potential usages are: debugging, logging or data sanitization.
Last updated a year ago by runk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dtrim 
SYNC missed versions from official npm registry.

dtrim Build Status

A tool for trimming deep/lenghty javascript structures. Some potential usages are: debugging, logging or data sanitization.

Installation

npm i dtrim

Usage

const dtrim = require('dtrim');

const trim = dtrim.trimmer({ depth: 4 });
const nasty = { ... a big, deep and nasty object here ... };
const nice = trim(nasty);

Options

dtrim.trimmer([options])

  • options: <Object>

    • depth: <number> Trim depth - all structures deeper than this will be omitted from output. This is useful for truncating large complicated objects. To make it return full structure, pass Infinity or some arbitrary large number. Default: 4.
    • size: <number> Trim size - all objects and arrays that are longer/bigger than this size will be trimmed. Note on trimming objects: because order of properties is not guaranteed by spec, objects with number of properties bigger than size will be represented as string "Object(N)". To make it return full structure, pass Infinity or some arbitrary large number. Default: 64.
    • string: <number> Trim strings that are longer than specified number. To make it return full structure, pass Infinity or some arbitrary large number. Default: 512.
    • buffer: <boolean> Substitues instancs of a Buffer object with their string representation: "Buffer(N)". Default: true.
  • Returns: <Function> - trimmer function that accepts input argument of any type.

License

MIT

Current Tags

  • 1.9.0                                ...           latest (a year ago)

14 Versions

  • 1.9.0                                ...           a year ago
  • 1.8.0                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.1                                ...           a year ago
  • 1.6.0                                ...           a year ago
  • 1.5.0                                ...           a year ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |