bit/utils/object/clean

cleans all object's properties that contains a falsy value and returns a new object without them.

0 Likes
Use in your codeLearn 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