Socket
Socket
Sign inDemoInstall

remove-undefined-objects

Package Overview
Dependencies
0
Maintainers
10
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remove-undefined-objects

Remove undefined properties and empty arrays from an object


Version published
Maintainers
10
Install size
16.5 kB
Created

Readme

Source

remove-undefined-objects

Build

Installation

npm install --save remove-undefined-objects

Usage

import removeUndefinedObjects from 'remove-undefined-objects';

console.log(removeUndefinedObjects({key: [], key2: 123}));
// { key2: 123 }

Behavior

Any items with the following value will be removed:

  • Empty object, {}
  • Empty array, []
  • Undefined, undefined

The following items will NOT be removed:

  • Empty string, ''
  • Null, null

FAQs

Last updated on 07 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc