1.0.1 • Published 10 years ago

gotit v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

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