nullpo
v0.1.0
Published
Remove falsey values from array and object
Downloads
4
Readme
nullpo
Remove falsey values from array and object
Install
yarn add [-D] nullpo
Usage
import nullpo from 'nullpo';
nullpo(['foo', null, '', 123, false, () => {}]);
// [ 'foo', 123, [Function] ]
nullpo({
foo: 'foo',
null: null,
empty: '',
number: 123,
boolean: false,
function() {}
});
// {
// foo: 'foo',
// number: 123,
// function: [Function: function]
// }
nullpo('foo'); // 'foo'
nullpo(123); // 123
API
export type NullpoArray = any[];
export type NullpoObject = {[k: string]: any};
declare function nullpo(args: NullpoArray): NullpoArray;
declare function nullpo(args: NullpoObject): NullpoObject;
declare function nullpo(args: any): any;
Lisence
The MIT License (MIT)
Copyright (c) 2017 nju33 [email protected]