diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/clean-yaml-object/readme.md | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) | |
download | wallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/clean-yaml-object/readme.md')
-rw-r--r-- | node_modules/clean-yaml-object/readme.md | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/node_modules/clean-yaml-object/readme.md b/node_modules/clean-yaml-object/readme.md new file mode 100644 index 000000000..4e4e5a67b --- /dev/null +++ b/node_modules/clean-yaml-object/readme.md @@ -0,0 +1,52 @@ +# clean-yaml-object [![Build Status](https://travis-ci.org/tapjs/clean-yaml-object.svg?branch=master)](https://travis-ci.org/tapjs/clean-yaml-object) [![Coverage Status](https://coveralls.io/repos/tapjs/clean-yaml-object/badge.svg?branch=master&service=github)](https://coveralls.io/github/tapjs/clean-yaml-object?branch=master) + +> Clean up an object prior to serialization. + +Replaces circular references, pretty prints Buffers, and numerous other enhancements. Primarily designed to prepare Errors for serialization to JSON/YAML. + +Extracted from [`node-tap`](https://github.com/tapjs/node-tap) + +## Install + +``` +$ npm install --save clean-yaml-object +``` + + +## Usage + +```js +const cleanYamlObject = require('clean-yaml-object'); + +cleanYamlObject(new Error('foo')); +//=> {name: 'Error', message: 'foo', stack: ...} +``` + + +## API + +### cleanYamlObject(input, [filterFn]) + +Returns a deep copy of `input` that is suitable for serialization. + +#### input + +Type: `*` + +Any object. + +#### filterFn + +Type: `callback(propertyName, isRoot, source, target)` + +Optional filter callback. Returning `true` will cause the property to be copied. Otherwise it will be skipped + +- `propertyName`: The property being copied. +- `isRoot`: `true` only if `source` is the top level object passed to `copyYamlObject` +- `source`: The source from which `source[propertyName]` will be copied. +- `target`: The target object. + +## License + + +MIT © [Isaac Z. Schlueter](http://github.com/isaacs) [James Talmage](http://github.com/jamestalmage) |