New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deep-compact

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-compact

Recursively compacts collection values (arrays and objects), removing empty values from your arrays & objects

  • 0.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by16.53%
Maintainers
1
Weekly downloads
 
Created
Source

deep-compact Build Status

Recursively compacts collection values (arrays and objects), removing empty values from your arrays & objects.
It will also trim and remove empty strings.

Installation

$ npm install deep-compact - NPM
$ bower install deep-compact - bower

The browser file is named index.umd.js which supports CommonJS, AMD and globals (deepCompact). If you want to run this module on old browsers, you must include es5-shim.

Usage

var deepcompact = require('deep-compact');

deepcompact({
    something: [
        {
            colors: ['red', ' green ', ''],
            cars: { audi: 'nice', vw: 'good', aston: '  ' }
        },
        undefined,
        ''
    ],
    foo: 'bar'
});

/*
{
    something: [
        {
            colors: ['red', 'green'],
            cars: { audi: 'nice', vw: 'good' }
        }
    ],
    foo: 'bar'
});
*/

Tests

$ npm test

License

Released under the MIT License.

Keywords

FAQs

Package last updated on 24 Jan 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc