Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 570 Bytes

README.md

File metadata and controls

29 lines (23 loc) · 570 Bytes

only-truthy

build npm version

Returns a new object with ALL object properties with falsy values removed.

Install

npm install only-truthy

Usage

import onlyTruthy from 'only-truthy';

const obj = onlyTruthy({
  a: true,
  b: false,
  c: null,
  d: undefined,
  e: NaN,
  f: '',
  g: 0,
});

console.log(obj);
// => { a: true };