New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

deep-empty-object

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-empty-object

Check an object, if all or some of its leaf nodes are empty. It detects empty string, empty array, empty object, null, undefined in the target object.

Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
985
-19.66%
Maintainers
1
Weekly downloads
 
Created
Source

deep-empty-object.js

Intro

Check an object, if all or some of its leaf nodes are empty. It detects empty string, empty array, empty object, null, undefined in the target object.

Install

$ npm install deep-empty-object

Usage

import empty from 'deep-empty-object'
empty.all({
    foo: '',
    bar: []
}) // => true

empty.some({
    foo: {},
    bar: []
}) // => true

empty.all({
    foo: {
        baz:[]
    },
    bar: [false]
}) // => false

empty.some({
    foo: {
        baz: ''
    },
    bar: [true]
}) // => true

API

empty.all

  • param {object} obj
  • return {boolean} If all of the leaf nodes of the target object, include array, object, string, null, undefined are empty, it will be true, else, false.

empty.some

  • param {object} obj
  • return {boolean} If some of the leaf nodes of the target object, include array, object, string, null, undefined are empty, it will be true, else, false.

Test

$ npm test

Keywords

object

FAQs

Package last updated on 25 Jan 2016

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