Git Product home page Git Product logo

clean-yaml-object's Introduction

clean-yaml-object Build Status Coverage Status

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

Install

$ npm install --save clean-yaml-object

Usage

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 James Talmage

clean-yaml-object's People

Contributors

jamestalmage avatar isaacs avatar bdentino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.