nullpo
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

nullpo

Remove falsey values from array and object

npm: nullpo CircleCI Coverage Status XO code style License: MIT code style: prettier TypeScript

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 nju33.ki@gmail.com

Readme

Keywords

Package Sidebar

Install

npm i nullpo

Weekly Downloads

14

Version

0.1.0

License

MIT

Unpacked Size

6.33 kB

Total Files

10

Last publish

Collaborators

  • nju33