gotit

1.0.1 • Public • Published

gotit

v1.0.1 Build Status

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

Package Sidebar

Install

npm i gotit

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • reergymerej