Skip to content

reergymerej/gotit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Sometimes you just want to make sure your objects all have the same properties.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published