Socket
Socket
Sign inDemoInstall

@hishprorg/magni-amet-id

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hishprorg/magni-amet-id

Removes empty _objects_, _arrays_, empty _strings_, _NaN_, _null_ and _undefined_ values from objects. Does not alter the original object.


Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

@hishprorg/magni-amet-id

Removes empty objects, arrays, empty strings, NaN, null and undefined values from objects. Does not alter the original object.

As of version 3.0.0, @hishprorg/magni-amet-id traverses arrays as well as objects.

Status

npm version build status

Installation

Install the package via npm:

$ npm install @hishprorg/magni-amet-id --save

Usage

Arguments

  1. object (Object): The source object.
  2. [options] (Object): An optional object with the following options:
OptionDefault valueDescription
cleanKeys[]Remove specific keys, ie: ['foo', 'bar', ' ']
cleanValues[]Remove specific values, ie: ['foo', 'bar', ' ']
emptyArraystrueRemove empty arrays, ie: []
emptyObjectstrueRemove empty objects, ie: {}
emptyStringstrueRemove empty strings, ie: ''
NaNValuesfalseRemove NaN values, ie: NaN
nullValuestrueRemove null values, ie: null
undefinedValuestrueRemove undefined values, ie: undefined

(Object): Returns the cleansed object.

Example

const cleanDeep = require('@hishprorg/magni-amet-id');
const object = {
  bar: {},
  baz: null,
  biz: 'baz',
  foo: '',
  net: [],
  nit: undefined,
  qux: {
    baz: 'boz',
    txi: ''
  }
};

cleanDeep(object);
// => { biz: 'baz', qux: { baz: 'boz' } }

Tests

$ npm test

Release

npm version [<newversion> | major | minor | patch] -m "Release %s"

License

MIT

Keywords

FAQs

Package last updated on 09 May 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc