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 67d0198ca6 switch to standard js style 🖌 4 years ago
.editorconfig switch to standard js style 🖌 4 years ago
README.md add exceptional-objects 5 years ago
index.js convert to old fashioned javascript from the 1940s 5 years ago
package.json switch to standard js style 🖌 4 years ago
yarn.lock switch to standard js style 🖌 4 years ago

README.md

exceptional objects

create strict objects that will throw an exception if you try to get a property from them that they don't have.

uses Proxy.

here's some typed up:

const exceptional = require('exceptional-objects')
const dog = exceptional({bark: 'woof', color: 'tan'})
dog.bark
//-> 'woof'
dog.color
//-> 'tan'
dog.name
//-> throws "Error: Object does not contain name"

you can still set things like normal:

const lol = exceptional({})
console.log(lol.dog) //-> throws "Error: Object does not contain dog"
lol.dog = 'henry'
console.log(lol.dog) //-> henry