[Pkg-javascript-commits] [node-clean-yaml-object] 04/21: documentation

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:52:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-clean-yaml-object.

commit 6dc007fbff408028bbba84fb3a630bb1c36caf02
Author: James Talmage <james at talmage.io>
Date:   Fri Jan 15 22:43:06 2016 -0500

    documentation
---
 readme.md | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/readme.md b/readme.md
index 7c5d3aa..348db9d 100644
--- a/readme.md
+++ b/readme.md
@@ -1,7 +1,10 @@
 # clean-yaml-object [![Build Status](https://travis-ci.org/jamestalmage/clean-yaml-object.svg?branch=master)](https://travis-ci.org/jamestalmage/clean-yaml-object)
 
-> My flawless module
+> Cleans an object up for pretty printing.
 
+Replaces circular references, pretty prints Buffers, and numerous other enhancements. Primarily designed to serialize Errors for serialization to JSON/YAML.
+
+Extracted from [`node-tap`](https://github.com/tapjs/node-tap)
 
 ## Install
 
@@ -15,30 +18,33 @@ $ npm install --save clean-yaml-object
 ```js
 const cleanYamlObject = require('clean-yaml-object');
 
-cleanYamlObject('unicorns');
-//=> 'unicorns & rainbows'
+cleanYamlObject(new Error('foo'));
+//=> {name: 'Error', message: 'foo', stack: ...}
 ```
 
 
 ## API
 
-### cleanYamlObject(input, [options])
+### cleanYamlObject(input, [filterFn])
 
-#### input
+Returns a deep copy of `input`, 
 
-Type: `string`
+#### input
 
-Lorem ipsum.
+Type: `*`
 
-#### options
+Any object.
 
-##### foo
+#### filterFn
 
-Type: `boolean`  
-Default: `false`
+Type: `function(propertyName, isRoot, source, target)`
 
-Lorem ipsum.
+Optional filter function. Returning `true` will cause the property to be copied.
 
+- `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
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-clean-yaml-object.git



More information about the Pkg-javascript-commits mailing list