@guildadev/remove-nil-keys
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Introduction

This package provides a function to remove nil keys from a map.

Installation

´´´bash yarn add @guidadev/remove-nil-keys ´´´

or

´´´bash npm install @guidadev/remove-nil-keys ´´´

Usage

Here's how you can start using @guidadev/remove-nil-keys in your projects:

import removeNilKeys from '@guildadev/remove-nil-keys';

const inputObject = {
  a: 42,
  b: '',
  c: null,
  d: undefined,
  e: 0,
  f: 'hello',
  g: false,
};

removeNilKeys(inputObject); // {  a: 42, b: '', e: 0, f: 'hello', g: false }

You can also use imutable version of this function:

import { removeNilKeysImultable } from '@guidadev/remove-nil-keys';

const inputObject = {
  a: 42,
  b: '',
  c: null,
  d: undefined,
  e: 0,
  f: 'hello',
  g: false,
};

const data = removeNilKeysImultable(inputObject); // {  a: 42, b: '', e: 0, f: 'hello', g: false }

Readme

Keywords

none

Package Sidebar

Install

npm i @guildadev/remove-nil-keys

Weekly Downloads

0

Version

1.0.1

License

none

Unpacked Size

3.55 kB

Total Files

5

Last publish

Collaborators

  • alexcastrodev