JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q47187F
  • License MIT

this package will delete null or empty objects from an object

Package Exports

  • delete-null

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (delete-null) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

delete-null

Cleaning Objects was never more easy.

const deleteNull = require('delete-null');

var obj = {
  name: "ribhu",
  surname: "ratnam",
  age: 20,
  bio: {},
  friends: {
    first : undefined,
    second : null
  },
  books: {
    first: "Harry Potter",
    second: {},
    third: null,
    fourth : undefined
  }
}

obj = deleteNull(obj);
  /*
  obj = {
    name: "ribhu",
    surname: "ratnam",
    age: 20,
    books: {
      first: "Harry Potter"
    }
  }
  */

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install delete-null

Features

  • Handles null
  • Handles empty objects
  • Handles undefined values
  • Fast & recursive

Philosophy

While dealing with objects, we often have to write code to handle null or empty objects or undefined values. This package will handle all that, giving you an Object that doesn't contain unwanted values.

People

Author of delete-null is Ribhu Ratnam.

Visit Ribhu's website for contact.

License

MIT