UNPKG

@assertive-ts/core

Version:

A type-safe fluent assertion library

41 lines 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isHighInclusiveOptions = exports.isLowInclusiveOptions = exports.isInclusiveOptions = exports.isAnyFunction = exports.isPromise = exports.isKeyOf = exports.isStruct = void 0; function isStruct(value) { return typeof value === "object" && value !== null && !Array.isArray(value); } exports.isStruct = isStruct; function isKeyOf(target, key) { return (typeof key === "string" || typeof key === "number" || typeof key === "symbol") && key in target; } exports.isKeyOf = isKeyOf; function isPromise(value) { const maybePromise = value; return (typeof value === "object" && typeof (maybePromise === null || maybePromise === void 0 ? void 0 : maybePromise.then) === "function" && typeof (maybePromise === null || maybePromise === void 0 ? void 0 : maybePromise.catch) === "function" && typeof (maybePromise === null || maybePromise === void 0 ? void 0 : maybePromise.finally) === "function"); } exports.isPromise = isPromise; function isAnyFunction(func) { return typeof func === "function"; } exports.isAnyFunction = isAnyFunction; function isInclusiveOptions(options) { return options.inclusive !== undefined; } exports.isInclusiveOptions = isInclusiveOptions; function isLowInclusiveOptions(options) { return options.lowInclusive !== undefined; } exports.isLowInclusiveOptions = isLowInclusiveOptions; function isHighInclusiveOptions(options) { return options.highInclusive !== undefined; } exports.isHighInclusiveOptions = isHighInclusiveOptions; //# sourceMappingURL=guards.js.map