npm install property-handlers --save
var propertyHandlers = require('property-handlers');
propertyHandlers(object, handlers, path);
object
: An object with propertieshandlers
: An object with properties that correspond to allowed properties. The value of each property should be a handlerfunction
path
: Used for error reporting
var object = {
foo: 'foo',
bar: 'bar'
};
propertyHandlers(
object,
{
foo: function(value) {
// value === 'foo'
},
bar: function(value) {
// bar === 'bar'
}
},
'some path');