Package Exports
- object-normalizer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-normalizer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ObjectNormalizer
const schema = {
'prop1': function (value) {
if (value == undefined)
value = 1;
return value;
},
'prop2': function (value) {
if (typeof value !== 'function')
throw new Error(`'prop2' must be of Function type.`);
return value;
}
};
const defaultPropertyName = 'prop2';
let nor = new ObjectNormalizer(schema, defaultPropertyName);
let r = nor.normalize(function () { });
console.log(r);
// { prop1: 1, prop2: [Function] }
Install
$ npm install object-normalizer