gotit
v1.0.1
Published
Sometimes you just want to make sure your objects all have the same properties.
Maintainers
Readme
gotit
Sometimes you just want to make sure your objects all have the same properties.
import gotit from 'gotit';
// define the interface
const car = gotit(['wheels', 'doors']);
// use the interface to make sure fields are what you expect
const hooptie = car({
wheels: 3,
doors: 2,
});
// throws when fields are missing
const bicycle = car({
wheels: 2,
});
// throws when finding an unexpected field
const truck = car({
wheels: 4,
doors: 2,
cab: 'extended',
});kickstarted by npm-boom
