Gravatar for undefined
3 Likes

Cleans all object’s properties that contains a falsy value

Use in your code Learn more
bit import bit.utils/object/clean

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