You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chee 29d5dacf52 1.1.0 5 years ago
README.md add a simple readme 5 years ago
index.js allow set value of property to be `undefined` 5 years ago
package.json 1.1.0 5 years ago

README.md

object with default value

const objectDefault = require('object-with-default-value')

const lol = objectDefault({a: 1, b: 2, c: 3}, 100)

console.log(lol.a) // 1
console.log(lol.b) // 2
console.log(lol.wow) // 100

you can still set things like normal:

console.log(lol.dog) // 100
lol.dog = 'henry'
console.log(lol.dog) // "henry"