UNPKG

valid-props

Version:
16 lines (13 loc) 413 B
'use strict'; function verifyPropertiesExist(params, schema) { var missingProperties = Object.keys(schema).filter(function (key) { return !params.hasOwnProperty([key]); }); if (missingProperties.length) { var errorMsg = 'Missing properties: ' + missingProperties.join(', '); throw new Error(errorMsg); } } module.exports = { propertiesExist: verifyPropertiesExist };