clean

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
32
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 years ago
SIZE
570 B
Cleans all object's properties that contains a falsy value and returns a new object without them.
2 contributors
Install clean as a package?
Copied
npm i @bit/bit.utils.object.clean
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
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 falsy

Pass

#clean() should return an empty object as all properties are falsy

Pass

#clean() should throw a type error in case a non-object value was passed

Pass
Help and resources