1.0.1 • Published 1 year ago

@guildadev/remove-nil-keys v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

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 }
1.0.1

1 year ago

1.0.0

1 year ago