clean-options
v1.0.0
Published
clean options
Downloads
9
Readme
Clean Options
Clean options.
Introduction
- Ensure options is an object
- Remove undefined fields in options object shallowly
Installation
npm i clean-options
Usage
const clean = require('clean-options')
function say(options) {
const {
name = 'Bob'
} = clean(options)
console.log(name)
}
say({name: 'Alice'}) // Alice
say({name: undefined}) // Bob
say({}) // Bob
say() // Bob
License
MIT