All Projects → jonschlinkert → omit-empty

jonschlinkert / omit-empty

Licence: MIT license
Recursively omit empty properties from an object. Omits empty objects, arrays, strings, and optionally zero. Similar results to what you would expect with `compact` for arrays.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to omit-empty

object.omit
Return a copy of an object without the given keys.
Stars: ✭ 79 (+11.27%)
Mutual labels:  object, remove, omit
expand-hash
Recursively expands property keys with dot-notation into objects.
Stars: ✭ 25 (-64.79%)
Mutual labels:  object, keys
rename-keys
Modify/rename the keys of the own enumerable properties of an object.
Stars: ✭ 28 (-60.56%)
Mutual labels:  object, keys
normalize-pkg
Normalize values in package.json to improve compatibility, programmatic readability and usefulness with third party libs.
Stars: ✭ 18 (-74.65%)
Mutual labels:  object, jonschlinkert
object-keys
Object.keys shim
Stars: ✭ 41 (-42.25%)
Mutual labels:  object, keys
stringify-keys
Build an array of key paths from an object.
Stars: ✭ 18 (-74.65%)
Mutual labels:  object, keys
Object Oriented Programming Using Python
Python is a multi-paradigm programming language. Meaning, it supports different programming approach. One of the popular approach to solve a programming problem is by creating objects. This is known as Object-Oriented Programming (OOP).
Stars: ✭ 183 (+157.75%)
Mutual labels:  object
wastebasket
A crossplatform go library for moving files to the trashbin
Stars: ✭ 30 (-57.75%)
Mutual labels:  remove
Object Visualizer
Vue JSON inspector with Chrome-like theme.
Stars: ✭ 159 (+123.94%)
Mutual labels:  object
Node Console Probe
Inspect JavaScript object methods and properties in the console.
Stars: ✭ 139 (+95.77%)
Mutual labels:  object
reach-schema
Functional schema-driven JavaScript object validation library.
Stars: ✭ 34 (-52.11%)
Mutual labels:  object
js-deep-sort-object
Simple module to sort objects recursively by its keys
Stars: ✭ 19 (-73.24%)
Mutual labels:  object
X2struct
Convert between json string and c++ object. json字符串和c++结构体之间互相转换
Stars: ✭ 251 (+253.52%)
Mutual labels:  object
Get Value
Use property paths (`a.b.c`) get a nested value from an object.
Stars: ✭ 194 (+173.24%)
Mutual labels:  object
webpack-omit-js-for-css-plugin
This plugin will omit bundled JS files for dependencies that are exclusively CSS, which become obsolete once mini-css-extract-plugin extracts inlined CSS into its own .css file
Stars: ✭ 14 (-80.28%)
Mutual labels:  omit
Deepdash
eachDeep, filterDeep, findDeep, someDeep, omitDeep, pickDeep, keysDeep etc.. Tree traversal library written in Underscore/Lodash fashion
Stars: ✭ 175 (+146.48%)
Mutual labels:  object
object-visit
Call the given method on each value in the given object.
Stars: ✭ 19 (-73.24%)
Mutual labels:  object
Nope Validator
A small, simple and fast JS validator. Like, wow thats fast. 🚀
Stars: ✭ 142 (+100%)
Mutual labels:  object
Clone Deep
Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. Used by superstruct, merge-deep, and many others!
Stars: ✭ 229 (+222.54%)
Mutual labels:  object
has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (-61.97%)
Mutual labels:  object

omit-empty NPM version NPM monthly downloads NPM total downloads Linux Build Status

Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save omit-empty

Heads up!

Breaking changes in v1.0.0! See the Release History.

Usage

const omitEmpty = require('omit-empty');

console.log(omitEmpty({ a: 'a', b: '' }));
//=> { a: 'a' }

console.log(omitEmpty({ a: 'a', b: { c: 'c', d: '' } }));
//=> { a: 'a', b: { c: 'c' } }

console.log(omitEmpty({ a: ['a'], b: [] }));
//=> { a: ['a'] }

console.log(omitEmpty({ a: 0, b: 1 }));
//=> { a: 0, b: 1 }

// set omitZero to true, to evaluate "0" as falsey
console.log(omitEmpty({ a: 0, b: 1 }, { omitZero: true }));
//=> { b: 1 }

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Contributors

Commits Contributor
31 jonschlinkert
1 kakadiadarpan

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.8.0, on December 10, 2018.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].