UNPKG

diffusion

Version:

Diffusion JavaScript client

18 lines (16 loc) 496 B
/*eslint valid-jsdoc: "off"*/ /** * Throw an error if the checked value is null/undefined. * * @param {Object} value - The value to check * @param {String} what - Description to include in thrown error * @returns The checked value * @throws An error if value is null or undefined */ function requireNonNull(value, what) { if (typeof value === 'undefined' || value === null) { throw new Error(what + " is null"); } return value; } module.exports = requireNonNull;