Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brh55/find-undefinedness
:x: Find keys containing undefined within an object with support for deeply nested objects
https://github.com/brh55/find-undefinedness
dotted-keys nested-objects node undefined
Last synced: 30 days ago
JSON representation
:x: Find keys containing undefined within an object with support for deeply nested objects
- Host: GitHub
- URL: https://github.com/brh55/find-undefinedness
- Owner: brh55
- License: mit
- Created: 2017-01-27T09:02:20.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-27T10:56:41.000Z (almost 8 years ago)
- Last Synced: 2024-09-14T08:38:48.059Z (about 2 months ago)
- Topics: dotted-keys, nested-objects, node, undefined
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# find-undefinedness [![Build Status](https://img.shields.io/travis/brh55/find-undefinedness.svg?style=flat-square)](https://travis-ci.org/brh55/find-undefinedness) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/sindresorhus/xo)
> Return dotted keys containing `undefined` values within an object including nested objects
>
> **findUndefindness({}) => [ keys ]**## Install
```
$ npm install --save find-undefinedness
```## Usage
### Flat Objects
```js
const findUndefinedness = require('find-undefinedness');const config = {
token: undefined,
username: 'brh55',
emoji: undefined
}
findUndefinedness(config);
//=> '[ 'token', 'emoji']
```
### Nested Objects```js
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 `` of dot notation keys if `undefined` is found, *else* `null`.*
#### object | [``](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Normal_objects_and_functions)
Object in question containing keys with undefinedness
## License
MIT © [Brandon Him](https://github.com/brh55)