Skip to content

yiwn/compact

Repository files navigation

compact

Create and return clone of provided object by excluding null and undefined properties.

Installation

Using component

$ component install yiwn/compact

Using npm for browserify

$ npm install yiwn-compact

Usage

Example:

var compact = require('yiwn-compact');

var obj = {
        a: 0,
        b: null,
        c: 'Shakira'
    };

var arr = [0, null, 'Shakira'];

compact(obj); // -> { a: 0, c: 'Sharkira' }
compact(obj); // -> [0, 'Shakira']

Test

Run tests with mocha

$ make test

License

The MIT License

About

Exclude `null` and `undefined` properties from given object.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published