shiny-object
v1.0.0
Published
Clean objects from your dirt.
Downloads
4
Readme
Shiny Object
Make your objects shine by cleaning off all the dirt. (eg. undefined, empty objects)
Usage
const shiny = require('shiny-object');
// input is not mutated
shiny(
{
string: '',
nill: null,
undef: undefined,
arr: [{ key: '' }],
fn: () => ({ func: () => {} }),
clean: 'value',
},
{
// All options default to false
noUndefined: true,
noNull: true,
noFunction: true,
noEmptyString: true,
noEmptyArray: true,
noEmptyObject: true,
}
); // { clean: 'value' }