Skip to content

❌ Find keys containing undefined within an object with support for deeply nested objects

License

Notifications You must be signed in to change notification settings

brh55/find-undefinedness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find-undefinedness Build Status XO code style

Return dotted keys containing undefined values within an object including nested objects

findUndefindness({}) => [ keys ]

Install

$ npm install --save find-undefinedness

Usage

Flat Objects

const findUndefinedness = require('find-undefinedness');

const config = {
    token: undefined,
    username: 'brh55',
    emoji: undefined
}
findUndefinedness(config);
//=> '[ 'token', 'emoji']

Nested Objects

const findUndefinedness = require('find-undefinedness');

const user = {
    name: undefined,
    github: {
        username: 'brh55',
        repositories: {
            personal: 43,
            private: undefined
        },
        followers: {
            username: 'rightlag',
            repositories: {
                personal: 20,
                private: undefined
            },
            stars: 1
        },
        stars: 100
    },
    emoji: undefined
}
findUndefinedness(user);
//=> [ 'name', 'github.repositories.private', 'github.followers.repositories.private', 'emoji' ]

API

findUndefinedness(object)

  • Returns <array> of dot notation keys if undefined is found, else null.*

object | <object>

Object in question containing keys with undefinedness

License

MIT © Brandon Him

About

❌ Find keys containing undefined within an object with support for deeply nested objects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published