@softchef/cdk-iot-device-management
Version:
IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.
20 lines (17 loc) • 637 B
JavaScript
;
/**
* Throws a TypeError when expected method doesn't exist
*
* @private
* @param {*} value A value to examine
* @param {string} method The name of the method to look for
* @param {name} name A name to use for the error message
* @param {string} methodPath The name of the method to use for error messages
* @throws {TypeError} When the method doesn't exist
*/
function assertMethodExists(value, method, name, methodPath) {
if (value[method] === null || value[method] === undefined) {
throw new TypeError(`Expected ${name} to have method ${methodPath}`);
}
}
module.exports = assertMethodExists;