0.2.2 • Published 8 years ago

nyce v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

nyce

JavaScript component interface definition and adherence utility

// in someModule.js
exports.index = (foo, bar) => { /* ... */ };
exports.aProp = {};

// elsewhere
const nyce = require('nyce')();
const someModule = require('./someModule');

const myInterface = {
  index: {
    type: 'function',
    args: [ 'foo', 'bar' ],
    // By default, for function validation, nyce will only check the number
    // of arguments present with no regard to naming. If you would like to 
    // fail validation if the names of the function arguments don't match the names 
    // of the the interface arguments set this to true
    enforceArgNaming: true
  },
  aProp: {
    type: 'object'
  }
};

nyce
  .define('resource', myInterface)
  .then(nyce.assertImplements('resource', someModule))
  .then(() => {
    console.log( 'yay!' );
  })
  .catch((e) => {
    console.log('oh no!')
  });
0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago