Clean-deep
clean-deep
Remove empty values from objects.
clean-deep
helps us to clean objects by removing empty []
, {}
, null
, undefined
, ''
from objects.
Around of 50 lines of code which makes use of lodash.transform
and recursively clean up your objects.
You could pass in the below options as per your requirement of the clean-up process.
Option | Default value | Description |
---|---|---|
emptyArrays | true | Remove empty arrays, ie: [] |
emptyObjects | true | Remove empty objects, ie: {} |
emptyStrings | true | Remove empty strings, ie: '' |
nullValues | true | Remove null values, ie: null |
undefinedValues | true | Remove null values, ie: undefined |
Get it: npm install clean-deep
Sample usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
GIF FTW!