🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

compact-object

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compact-object

Similar to omit-empty, recursively omits empty properties, but also compact/flatten nested arrays in an object.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
19
216.67%
Maintainers
1
Weekly downloads
 
Created
Source

compact-object NPM version

Similar to omit-empty, recursively omits empty properties, but also compact/flatten nested arrays in an object.

Install

Install with npm:

npm i compact-object --save-dev

Run tests

npm test

Usage

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

compact({a: 'a', b: ''});
//=> {a: 'a'}

compact({a: 'a', b: {c: 'c', d: ''});
//=> {a: 'a', b: {c: 'c'}

compact({a: ['a'], b: [['foo'], [], ['baz']]});
//=> {a: ['a'], b: ['foo', 'baz']}

compact({a: 0, b: 1});
//=> {a: 0, b: 1}

// set the `noZero` flag
compact({a: 0, b: 1}, true);
//=> {b: 1}

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

This file was generated by verb-cli on September 21, 2014.

Keywords

array

FAQs

Package last updated on 21 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts