Share your code. Components are building blocks, you are the architect.

object/clean
v1.0.0
1.0.0
0.0.1
MIT
PUBLIC
1
1     DEPENDENCIES
Build: pass
BuildPass
Build Status: pass
Cleans all object's properties that contains a falsy value
bit
Contributors
Gravatar for undefinedGravatar for undefined
1

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use object/clean in your project
npm i @bit/bit.utils.object.clean
Copied

clean (obj:object) : object

Cleans all object’s properties that contains a falsy value and returns a new object without them.

Example

new cleaned object
 clean({ foo: null, bar: 'foo' }) // => { bar: 'foo' }

Argument

obj: object

object to clean

Returns

object

Test Summary


#clean() should clean property `foo` as its value is falsyPass
#clean() should return an empty object as all properties are falsyPass
#clean() should throw a type error in case a non-object value was passedPass