confinode
Version:
Node application configuration reader
25 lines • 788 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Assert that the value does not exist. This method may be used in switch or if/else to ensure no value of
* a finite set has been forgotten.
*
* @param value - The non-existing value to test.
* @param label - The label for the value.
*/
/* istanbul ignore next */
function assertNever(value, label = 'object') {
throw new Error(`Unexpected ${label}: “${value}”`);
}
exports.assertNever = assertNever;
/**
* Check that the given value is not undefined. Used as type guard.
*
* @param value - The value to test.
* @returns `true` if value is not undefined.
*/
function isExisting(value) {
return value !== undefined;
}
exports.isExisting = isExisting;
//# sourceMappingURL=types.js.map