@webdeveric/utils 0.83.1 → 0.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/asArray.js +9 -0
- package/dist/cjs/asError.js +9 -0
- package/dist/cjs/assertion/assertExhaustive.js +19 -0
- package/dist/cjs/assertion/assertIsAsyncIterable.js +13 -0
- package/dist/cjs/assertion/assertIsBigInt.js +9 -0
- package/dist/cjs/assertion/assertIsBigIntArray.js +9 -0
- package/dist/cjs/assertion/assertIsBoolean.js +9 -0
- package/dist/cjs/assertion/assertIsBooleanArray.js +9 -0
- package/dist/cjs/assertion/assertIsDigitsString.js +9 -0
- package/dist/cjs/assertion/assertIsFiniteNumber.js +9 -0
- package/dist/cjs/assertion/assertIsFunction.js +9 -0
- package/dist/cjs/assertion/assertIsInt32.js +9 -0
- package/dist/cjs/assertion/assertIsIntString.js +9 -0
- package/dist/cjs/assertion/assertIsInteger.js +9 -0
- package/dist/cjs/assertion/assertIsIterable.js +9 -0
- package/dist/cjs/assertion/assertIsLengthAware.js +9 -0
- package/dist/cjs/assertion/assertIsNull.js +9 -0
- package/dist/cjs/assertion/assertIsNullArray.js +9 -0
- package/dist/cjs/assertion/assertIsNumber.js +9 -0
- package/dist/cjs/assertion/assertIsNumberArray.js +9 -0
- package/dist/cjs/assertion/assertIsNumberGTEOne.js +9 -0
- package/dist/cjs/assertion/assertIsNumericString.js +9 -0
- package/dist/cjs/assertion/assertIsNumericValue.js +11 -0
- package/dist/cjs/assertion/assertIsNumericValueArray.js +9 -0
- package/dist/cjs/assertion/assertIsObject.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalBigInt.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalBoolean.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalNull.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalNumber.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalString.js +10 -0
- package/dist/cjs/assertion/assertIsOptionalSymbol.js +10 -0
- package/dist/cjs/assertion/assertIsPositiveFiniteNumber.js +9 -0
- package/dist/cjs/assertion/assertIsPositiveInteger.js +9 -0
- package/dist/cjs/assertion/assertIsPrimitive.js +9 -0
- package/dist/cjs/assertion/assertIsPromiseFulfilledResult.js +11 -0
- package/dist/cjs/assertion/assertIsPromiseRejectedResult.js +11 -0
- package/dist/cjs/assertion/assertIsPropertyKey.js +11 -0
- package/dist/cjs/assertion/assertIsSafeInteger.js +9 -0
- package/dist/cjs/assertion/assertIsSizeAware.js +9 -0
- package/dist/cjs/assertion/assertIsString.js +9 -0
- package/dist/cjs/assertion/assertIsStringArray.js +9 -0
- package/dist/cjs/assertion/assertIsStringMatching.js +9 -0
- package/dist/cjs/assertion/assertIsStringRecord.js +9 -0
- package/dist/cjs/assertion/assertIsStringWithLength.js +9 -0
- package/dist/cjs/assertion/assertIsSymbol.js +9 -0
- package/dist/cjs/assertion/assertIsSymbolArray.js +9 -0
- package/dist/cjs/assertion/assertIsUndefined.js +9 -0
- package/dist/cjs/assertion/assertIsUndefinedArray.js +9 -0
- package/dist/cjs/assertion/assertPathExists.js +12 -0
- package/dist/cjs/assertion/assertPredicate.js +11 -0
- package/dist/cjs/assertion/getError.js +9 -0
- package/dist/cjs/capitalize.js +8 -0
- package/dist/cjs/cartesian.js +10 -0
- package/dist/cjs/chunk.js +8 -0
- package/dist/cjs/clamp.js +9 -0
- package/dist/cjs/combinations.js +8 -0
- package/dist/cjs/comment.js +11 -0
- package/dist/cjs/compose.js +11 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/convert.js +8 -0
- package/dist/cjs/countCharCode.js +8 -0
- package/dist/cjs/countCharacter.js +8 -0
- package/dist/cjs/counter.js +8 -0
- package/dist/cjs/dedent.js +14 -0
- package/dist/cjs/deepDecodeURI.js +8 -0
- package/dist/cjs/deepFreeze.js +13 -0
- package/dist/cjs/delay.js +14 -0
- package/dist/cjs/delayAnimationFrame.js +9 -0
- package/dist/cjs/delayAnimationFrames.js +9 -0
- package/dist/cjs/describeInput.js +12 -0
- package/dist/cjs/escapeRegExp.js +8 -0
- package/dist/cjs/findIndentation.js +8 -0
- package/dist/cjs/get.js +9 -0
- package/dist/cjs/getDateString.js +8 -0
- package/dist/cjs/getISODateString.js +8 -0
- package/dist/cjs/getMaxValue.js +8 -0
- package/dist/cjs/getMilliseconds.js +9 -0
- package/dist/cjs/getMinValue.js +8 -0
- package/dist/cjs/getOwnKeys.js +8 -0
- package/dist/cjs/getOwnPaths.js +8 -0
- package/dist/cjs/getOwnProperties.js +8 -0
- package/dist/cjs/getPackageName.js +9 -0
- package/dist/cjs/getPaths.js +8 -0
- package/dist/cjs/getRandomItem.js +8 -0
- package/dist/cjs/getSortedObject.js +8 -0
- package/dist/cjs/getType.js +9 -0
- package/dist/cjs/has.js +9 -0
- package/dist/cjs/hasAdditionalProperties.js +9 -0
- package/dist/cjs/inRange.js +9 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/isEmpty.js +9 -0
- package/dist/cjs/iterateForever.js +13 -0
- package/dist/cjs/joinStrings.js +8 -0
- package/dist/cjs/jsonParse.js +8 -0
- package/dist/cjs/looksLikeURL.js +10 -0
- package/dist/cjs/normalize.js +17 -0
- package/dist/cjs/numbers.js +3 -3
- package/dist/cjs/parseNumber.js +9 -0
- package/dist/cjs/pathParts.js +8 -0
- package/dist/cjs/predicate/assume.js +14 -0
- package/dist/cjs/predicate/factory/allOf.js +11 -0
- package/dist/cjs/predicate/factory/anyOf.js +11 -0
- package/dist/cjs/predicate/factory/everyItem.js +11 -0
- package/dist/cjs/predicate/factory/fromEnum.js +20 -0
- package/dist/cjs/predicate/factory/instanceOf.js +10 -0
- package/dist/cjs/predicate/factory/is.js +10 -0
- package/dist/cjs/predicate/factory/literal.js +10 -0
- package/dist/cjs/predicate/factory/matching.js +10 -0
- package/dist/cjs/predicate/factory/maybeArray.js +11 -0
- package/dist/cjs/predicate/factory/nonNullable.js +13 -0
- package/dist/cjs/predicate/factory/nullable.js +11 -0
- package/dist/cjs/predicate/factory/nullish.js +12 -0
- package/dist/cjs/predicate/factory/optional.js +11 -0
- package/dist/cjs/predicate/factory/range.js +10 -0
- package/dist/cjs/predicate/factory/shape.js +13 -0
- package/dist/cjs/predicate/factory/simple.js +10 -0
- package/dist/cjs/predicate/factory/stringLength.js +11 -0
- package/dist/cjs/predicate/factory/tuple.js +11 -0
- package/dist/cjs/predicate/factory/typeOf.js +11 -0
- package/dist/cjs/predicate/factory/withLength.js +15 -0
- package/dist/cjs/predicate/factory/withSize.js +14 -0
- package/dist/cjs/predicate/index.js +0 -1
- package/dist/cjs/predicate/isAny.js +10 -0
- package/dist/cjs/predicate/isAnyObject.js +9 -0
- package/dist/cjs/predicate/isAnyObjectWith.js +9 -0
- package/dist/cjs/predicate/isAnyObjectWithOwn.js +9 -0
- package/dist/cjs/predicate/isArray.js +9 -0
- package/dist/cjs/predicate/isAsyncIterable.js +12 -0
- package/dist/cjs/predicate/isBigInt.js +9 -0
- package/dist/cjs/predicate/isBigIntArray.js +9 -0
- package/dist/cjs/predicate/isBinaryNumberString.js +11 -0
- package/dist/cjs/predicate/isBoolean.js +9 -0
- package/dist/cjs/predicate/isBooleanArray.js +9 -0
- package/dist/cjs/predicate/isDateInputString.js +9 -0
- package/dist/cjs/predicate/isDigitsString.js +9 -0
- package/dist/cjs/predicate/isFiniteNumber.js +9 -0
- package/dist/cjs/predicate/isFunction.js +9 -0
- package/dist/cjs/predicate/isHexNumberString.js +11 -0
- package/dist/cjs/predicate/isISODateString.js +12 -0
- package/dist/cjs/predicate/isInt32.js +9 -0
- package/dist/cjs/predicate/isIntString.js +9 -0
- package/dist/cjs/predicate/isInteger.js +9 -0
- package/dist/cjs/predicate/isIterable.js +9 -0
- package/dist/cjs/predicate/isJSONable.js +11 -1
- package/dist/cjs/predicate/isLengthAware.js +9 -0
- package/dist/cjs/predicate/isNonNullable.js +9 -0
- package/dist/cjs/predicate/isNull.js +9 -0
- package/dist/cjs/predicate/isNullArray.js +9 -0
- package/dist/cjs/predicate/isNullish.js +9 -0
- package/dist/cjs/predicate/isNumber.js +9 -0
- package/dist/cjs/predicate/isNumberArray.js +9 -0
- package/dist/cjs/predicate/isNumericString.js +9 -0
- package/dist/cjs/predicate/isNumericValue.js +9 -0
- package/dist/cjs/predicate/isNumericValueArray.js +9 -0
- package/dist/cjs/predicate/isObject.js +9 -0
- package/dist/cjs/predicate/isObjectLiteral.js +9 -0
- package/dist/cjs/predicate/isObjectWith.js +9 -0
- package/dist/cjs/predicate/isOctalNumberString.js +11 -0
- package/dist/cjs/predicate/isOptionalArray.js +9 -0
- package/dist/cjs/predicate/isOptionalBigInt.js +9 -0
- package/dist/cjs/predicate/isOptionalBoolean.js +9 -0
- package/dist/cjs/predicate/isOptionalISODateString.js +9 -0
- package/dist/cjs/predicate/isOptionalNull.js +9 -0
- package/dist/cjs/predicate/isOptionalNumber.js +9 -0
- package/dist/cjs/predicate/isOptionalObject.js +9 -0
- package/dist/cjs/predicate/isOptionalString.js +9 -0
- package/dist/cjs/predicate/isOptionalSymbol.js +9 -0
- package/dist/cjs/predicate/isPositiveFiniteNumber.js +9 -0
- package/dist/cjs/predicate/isPositiveInteger.js +9 -0
- package/dist/cjs/predicate/isPrimitive.js +9 -0
- package/dist/cjs/predicate/isPromiseFulfilledResult.js +9 -0
- package/dist/cjs/predicate/isPromiseLike.js +9 -0
- package/dist/cjs/predicate/isPromiseRejectedResult.js +9 -0
- package/dist/cjs/predicate/isPropertyKey.js +9 -0
- package/dist/cjs/predicate/isSafeInteger.js +9 -0
- package/dist/cjs/predicate/isSizeAware.js +9 -0
- package/dist/cjs/predicate/isString.js +9 -0
- package/dist/cjs/predicate/isStringArray.js +9 -0
- package/dist/cjs/predicate/isStringRecord.js +9 -0
- package/dist/cjs/predicate/isStringWithLength.js +9 -0
- package/dist/cjs/predicate/isSymbol.js +9 -0
- package/dist/cjs/predicate/isSymbolArray.js +9 -0
- package/dist/cjs/predicate/isTimeoutError.js +13 -0
- package/dist/cjs/predicate/isUInt32.js +9 -0
- package/dist/cjs/predicate/isUndefined.js +9 -0
- package/dist/cjs/predicate/isUndefinedArray.js +9 -0
- package/dist/cjs/predicate/isUnknown.js +9 -0
- package/dist/cjs/predicate/isUrlString.js +9 -0
- package/dist/cjs/prefix.js +9 -0
- package/dist/cjs/randomInt.js +9 -0
- package/dist/cjs/redactCredentialsInURL.js +8 -0
- package/dist/cjs/resultify.js +25 -0
- package/dist/cjs/secToString.js +9 -0
- package/dist/cjs/set.js +13 -0
- package/dist/cjs/sort/byLocaleCompare.js +8 -0
- package/dist/cjs/sort/byRandom.js +9 -1
- package/dist/cjs/sort/bySimpleComparison.js +8 -0
- package/dist/cjs/sort/bySubtraction.js +8 -0
- package/dist/cjs/sort/byTimestamp.js +8 -0
- package/dist/cjs/sort/factory/byProperty.js +8 -0
- package/dist/cjs/sort/factory/byReverseOf.js +8 -0
- package/dist/cjs/stripIndent.js +8 -0
- package/dist/cjs/stripWhitespace.js +8 -0
- package/dist/cjs/suffix.js +9 -0
- package/dist/cjs/toPascalCase.js +10 -0
- package/dist/cjs/trimEnd.js +9 -0
- package/dist/cjs/trimIndentation.js +8 -0
- package/dist/cjs/trimStart.js +9 -0
- package/dist/cjs/tryFn.js +11 -0
- package/dist/cjs/tryIt.js +9 -0
- package/dist/cjs/types/common.js +1 -0
- package/dist/cjs/types/utils.js +1 -0
- package/dist/cjs/unique.js +8 -0
- package/dist/cjs/uniqueItems.js +8 -0
- package/dist/cjs/until.js +35 -0
- package/dist/mjs/asArray.js +9 -0
- package/dist/mjs/asError.js +9 -0
- package/dist/mjs/assertion/assertExhaustive.js +19 -0
- package/dist/mjs/assertion/assertIsAsyncIterable.js +13 -0
- package/dist/mjs/assertion/assertIsBigInt.js +9 -0
- package/dist/mjs/assertion/assertIsBigIntArray.js +9 -0
- package/dist/mjs/assertion/assertIsBoolean.js +9 -0
- package/dist/mjs/assertion/assertIsBooleanArray.js +9 -0
- package/dist/mjs/assertion/assertIsDigitsString.js +9 -0
- package/dist/mjs/assertion/assertIsFiniteNumber.js +9 -0
- package/dist/mjs/assertion/assertIsFunction.js +9 -0
- package/dist/mjs/assertion/assertIsInt32.js +9 -0
- package/dist/mjs/assertion/assertIsIntString.js +9 -0
- package/dist/mjs/assertion/assertIsInteger.js +9 -0
- package/dist/mjs/assertion/assertIsIterable.js +9 -0
- package/dist/mjs/assertion/assertIsLengthAware.js +9 -0
- package/dist/mjs/assertion/assertIsNull.js +9 -0
- package/dist/mjs/assertion/assertIsNullArray.js +9 -0
- package/dist/mjs/assertion/assertIsNumber.js +9 -0
- package/dist/mjs/assertion/assertIsNumberArray.js +9 -0
- package/dist/mjs/assertion/assertIsNumberGTEOne.js +9 -0
- package/dist/mjs/assertion/assertIsNumericString.js +9 -0
- package/dist/mjs/assertion/assertIsNumericValue.js +11 -0
- package/dist/mjs/assertion/assertIsNumericValueArray.js +9 -0
- package/dist/mjs/assertion/assertIsObject.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalBigInt.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalBoolean.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalNull.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalNumber.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalString.js +10 -0
- package/dist/mjs/assertion/assertIsOptionalSymbol.js +10 -0
- package/dist/mjs/assertion/assertIsPositiveFiniteNumber.js +9 -0
- package/dist/mjs/assertion/assertIsPositiveInteger.js +9 -0
- package/dist/mjs/assertion/assertIsPrimitive.js +9 -0
- package/dist/mjs/assertion/assertIsPromiseFulfilledResult.js +11 -0
- package/dist/mjs/assertion/assertIsPromiseRejectedResult.js +11 -0
- package/dist/mjs/assertion/assertIsPropertyKey.js +11 -0
- package/dist/mjs/assertion/assertIsSafeInteger.js +9 -0
- package/dist/mjs/assertion/assertIsSizeAware.js +9 -0
- package/dist/mjs/assertion/assertIsString.js +9 -0
- package/dist/mjs/assertion/assertIsStringArray.js +9 -0
- package/dist/mjs/assertion/assertIsStringMatching.js +9 -0
- package/dist/mjs/assertion/assertIsStringRecord.js +9 -0
- package/dist/mjs/assertion/assertIsStringWithLength.js +9 -0
- package/dist/mjs/assertion/assertIsSymbol.js +9 -0
- package/dist/mjs/assertion/assertIsSymbolArray.js +9 -0
- package/dist/mjs/assertion/assertIsUndefined.js +9 -0
- package/dist/mjs/assertion/assertIsUndefinedArray.js +9 -0
- package/dist/mjs/assertion/assertPathExists.js +12 -0
- package/dist/mjs/assertion/assertPredicate.js +11 -0
- package/dist/mjs/assertion/getError.js +9 -0
- package/dist/mjs/capitalize.js +8 -0
- package/dist/mjs/cartesian.js +10 -0
- package/dist/mjs/chunk.js +8 -0
- package/dist/mjs/clamp.js +9 -0
- package/dist/mjs/combinations.js +8 -0
- package/dist/mjs/comment.js +11 -0
- package/dist/mjs/compose.js +11 -0
- package/dist/mjs/constants.js +2 -0
- package/dist/mjs/convert.js +8 -0
- package/dist/mjs/countCharCode.js +8 -0
- package/dist/mjs/countCharacter.js +8 -0
- package/dist/mjs/counter.js +8 -0
- package/dist/mjs/dedent.js +14 -0
- package/dist/mjs/deepDecodeURI.js +8 -0
- package/dist/mjs/deepFreeze.js +13 -0
- package/dist/mjs/delay.js +14 -0
- package/dist/mjs/delayAnimationFrame.js +9 -0
- package/dist/mjs/delayAnimationFrames.js +9 -0
- package/dist/mjs/describeInput.js +12 -0
- package/dist/mjs/escapeRegExp.js +8 -0
- package/dist/mjs/findIndentation.js +8 -0
- package/dist/mjs/get.js +9 -0
- package/dist/mjs/getDateString.js +8 -0
- package/dist/mjs/getISODateString.js +8 -0
- package/dist/mjs/getMaxValue.js +8 -0
- package/dist/mjs/getMilliseconds.js +9 -0
- package/dist/mjs/getMinValue.js +8 -0
- package/dist/mjs/getOwnKeys.js +8 -0
- package/dist/mjs/getOwnPaths.js +8 -0
- package/dist/mjs/getOwnProperties.js +8 -0
- package/dist/mjs/getPackageName.js +9 -0
- package/dist/mjs/getPaths.js +8 -0
- package/dist/mjs/getRandomItem.js +8 -0
- package/dist/mjs/getSortedObject.js +8 -0
- package/dist/mjs/getType.js +9 -0
- package/dist/mjs/has.js +9 -0
- package/dist/mjs/hasAdditionalProperties.js +9 -0
- package/dist/mjs/inRange.js +9 -0
- package/dist/mjs/index.js +2 -0
- package/dist/mjs/isEmpty.js +9 -0
- package/dist/mjs/iterateForever.js +13 -0
- package/dist/mjs/joinStrings.js +8 -0
- package/dist/mjs/jsonParse.js +8 -0
- package/dist/mjs/looksLikeURL.js +10 -0
- package/dist/mjs/normalize.js +17 -0
- package/dist/mjs/numbers.js +3 -3
- package/dist/mjs/parseNumber.js +9 -0
- package/dist/mjs/pathParts.js +8 -0
- package/dist/mjs/predicate/assume.js +14 -0
- package/dist/mjs/predicate/factory/allOf.js +11 -0
- package/dist/mjs/predicate/factory/anyOf.js +11 -0
- package/dist/mjs/predicate/factory/everyItem.js +11 -0
- package/dist/mjs/predicate/factory/fromEnum.js +20 -0
- package/dist/mjs/predicate/factory/instanceOf.js +10 -0
- package/dist/mjs/predicate/factory/is.js +10 -0
- package/dist/mjs/predicate/factory/literal.js +10 -0
- package/dist/mjs/predicate/factory/matching.js +10 -0
- package/dist/mjs/predicate/factory/maybeArray.js +11 -0
- package/dist/mjs/predicate/factory/nonNullable.js +13 -0
- package/dist/mjs/predicate/factory/nullable.js +11 -0
- package/dist/mjs/predicate/factory/nullish.js +12 -0
- package/dist/mjs/predicate/factory/optional.js +11 -0
- package/dist/mjs/predicate/factory/range.js +10 -0
- package/dist/mjs/predicate/factory/shape.js +13 -0
- package/dist/mjs/predicate/factory/simple.js +10 -0
- package/dist/mjs/predicate/factory/stringLength.js +11 -0
- package/dist/mjs/predicate/factory/tuple.js +11 -0
- package/dist/mjs/predicate/factory/typeOf.js +11 -0
- package/dist/mjs/predicate/factory/withLength.js +15 -0
- package/dist/mjs/predicate/factory/withSize.js +14 -0
- package/dist/mjs/predicate/index.js +0 -1
- package/dist/mjs/predicate/isAny.js +10 -0
- package/dist/mjs/predicate/isAnyObject.js +9 -0
- package/dist/mjs/predicate/isAnyObjectWith.js +9 -0
- package/dist/mjs/predicate/isAnyObjectWithOwn.js +9 -0
- package/dist/mjs/predicate/isArray.js +9 -0
- package/dist/mjs/predicate/isAsyncIterable.js +12 -0
- package/dist/mjs/predicate/isBigInt.js +9 -0
- package/dist/mjs/predicate/isBigIntArray.js +9 -0
- package/dist/mjs/predicate/isBinaryNumberString.js +11 -0
- package/dist/mjs/predicate/isBoolean.js +9 -0
- package/dist/mjs/predicate/isBooleanArray.js +9 -0
- package/dist/mjs/predicate/isDateInputString.js +9 -0
- package/dist/mjs/predicate/isDigitsString.js +9 -0
- package/dist/mjs/predicate/isFiniteNumber.js +9 -0
- package/dist/mjs/predicate/isFunction.js +9 -0
- package/dist/mjs/predicate/isHexNumberString.js +11 -0
- package/dist/mjs/predicate/isISODateString.js +12 -0
- package/dist/mjs/predicate/isInt32.js +9 -0
- package/dist/mjs/predicate/isIntString.js +9 -0
- package/dist/mjs/predicate/isInteger.js +9 -0
- package/dist/mjs/predicate/isIterable.js +9 -0
- package/dist/mjs/predicate/isJSONable.js +11 -1
- package/dist/mjs/predicate/isLengthAware.js +9 -0
- package/dist/mjs/predicate/isNonNullable.js +9 -0
- package/dist/mjs/predicate/isNull.js +9 -0
- package/dist/mjs/predicate/isNullArray.js +9 -0
- package/dist/mjs/predicate/isNullish.js +9 -0
- package/dist/mjs/predicate/isNumber.js +9 -0
- package/dist/mjs/predicate/isNumberArray.js +9 -0
- package/dist/mjs/predicate/isNumericString.js +9 -0
- package/dist/mjs/predicate/isNumericValue.js +9 -0
- package/dist/mjs/predicate/isNumericValueArray.js +9 -0
- package/dist/mjs/predicate/isObject.js +9 -0
- package/dist/mjs/predicate/isObjectLiteral.js +9 -0
- package/dist/mjs/predicate/isObjectWith.js +9 -0
- package/dist/mjs/predicate/isOctalNumberString.js +11 -0
- package/dist/mjs/predicate/isOptionalArray.js +9 -0
- package/dist/mjs/predicate/isOptionalBigInt.js +9 -0
- package/dist/mjs/predicate/isOptionalBoolean.js +9 -0
- package/dist/mjs/predicate/isOptionalISODateString.js +9 -0
- package/dist/mjs/predicate/isOptionalNull.js +9 -0
- package/dist/mjs/predicate/isOptionalNumber.js +9 -0
- package/dist/mjs/predicate/isOptionalObject.js +9 -0
- package/dist/mjs/predicate/isOptionalString.js +9 -0
- package/dist/mjs/predicate/isOptionalSymbol.js +9 -0
- package/dist/mjs/predicate/isPositiveFiniteNumber.js +9 -0
- package/dist/mjs/predicate/isPositiveInteger.js +9 -0
- package/dist/mjs/predicate/isPrimitive.js +9 -0
- package/dist/mjs/predicate/isPromiseFulfilledResult.js +9 -0
- package/dist/mjs/predicate/isPromiseLike.js +9 -0
- package/dist/mjs/predicate/isPromiseRejectedResult.js +9 -0
- package/dist/mjs/predicate/isPropertyKey.js +9 -0
- package/dist/mjs/predicate/isSafeInteger.js +9 -0
- package/dist/mjs/predicate/isSizeAware.js +9 -0
- package/dist/mjs/predicate/isString.js +9 -0
- package/dist/mjs/predicate/isStringArray.js +9 -0
- package/dist/mjs/predicate/isStringRecord.js +9 -0
- package/dist/mjs/predicate/isStringWithLength.js +9 -0
- package/dist/mjs/predicate/isSymbol.js +9 -0
- package/dist/mjs/predicate/isSymbolArray.js +9 -0
- package/dist/mjs/predicate/isTimeoutError.js +13 -0
- package/dist/mjs/predicate/isUInt32.js +9 -0
- package/dist/mjs/predicate/isUndefined.js +9 -0
- package/dist/mjs/predicate/isUndefinedArray.js +9 -0
- package/dist/mjs/predicate/isUnknown.js +9 -0
- package/dist/mjs/predicate/isUrlString.js +9 -0
- package/dist/mjs/prefix.js +9 -0
- package/dist/mjs/randomInt.js +9 -0
- package/dist/mjs/redactCredentialsInURL.js +8 -0
- package/dist/mjs/resultify.js +25 -0
- package/dist/mjs/secToString.js +9 -0
- package/dist/mjs/set.js +13 -0
- package/dist/mjs/sort/byLocaleCompare.js +8 -0
- package/dist/mjs/sort/byRandom.js +9 -1
- package/dist/mjs/sort/bySimpleComparison.js +8 -0
- package/dist/mjs/sort/bySubtraction.js +8 -0
- package/dist/mjs/sort/byTimestamp.js +8 -0
- package/dist/mjs/sort/factory/byProperty.js +8 -0
- package/dist/mjs/sort/factory/byReverseOf.js +8 -0
- package/dist/mjs/stripIndent.js +8 -0
- package/dist/mjs/stripWhitespace.js +8 -0
- package/dist/mjs/suffix.js +9 -0
- package/dist/mjs/toPascalCase.js +10 -0
- package/dist/mjs/trimEnd.js +9 -0
- package/dist/mjs/trimIndentation.js +8 -0
- package/dist/mjs/trimStart.js +9 -0
- package/dist/mjs/tryFn.js +11 -0
- package/dist/mjs/tryIt.js +9 -0
- package/dist/mjs/types/common.js +1 -0
- package/dist/mjs/types/utils.js +1 -0
- package/dist/mjs/unique.js +8 -0
- package/dist/mjs/uniqueItems.js +8 -0
- package/dist/mjs/until.js +35 -0
- package/dist/types/asArray.d.ts +9 -0
- package/dist/types/asError.d.ts +9 -0
- package/dist/types/assertion/assertExhaustive.d.ts +19 -0
- package/dist/types/assertion/assertIsAsyncIterable.d.ts +13 -0
- package/dist/types/assertion/assertIsBigInt.d.ts +9 -0
- package/dist/types/assertion/assertIsBigIntArray.d.ts +9 -0
- package/dist/types/assertion/assertIsBoolean.d.ts +9 -0
- package/dist/types/assertion/assertIsBooleanArray.d.ts +9 -0
- package/dist/types/assertion/assertIsDigitsString.d.ts +9 -0
- package/dist/types/assertion/assertIsFiniteNumber.d.ts +9 -0
- package/dist/types/assertion/assertIsFunction.d.ts +9 -0
- package/dist/types/assertion/assertIsInt32.d.ts +9 -0
- package/dist/types/assertion/assertIsIntString.d.ts +9 -0
- package/dist/types/assertion/assertIsInteger.d.ts +9 -0
- package/dist/types/assertion/assertIsIterable.d.ts +9 -0
- package/dist/types/assertion/assertIsLengthAware.d.ts +9 -0
- package/dist/types/assertion/assertIsNull.d.ts +9 -0
- package/dist/types/assertion/assertIsNullArray.d.ts +9 -0
- package/dist/types/assertion/assertIsNumber.d.ts +9 -0
- package/dist/types/assertion/assertIsNumberArray.d.ts +9 -0
- package/dist/types/assertion/assertIsNumberGTEOne.d.ts +9 -0
- package/dist/types/assertion/assertIsNumericString.d.ts +9 -0
- package/dist/types/assertion/assertIsNumericValue.d.ts +11 -0
- package/dist/types/assertion/assertIsNumericValueArray.d.ts +9 -0
- package/dist/types/assertion/assertIsObject.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalBigInt.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalBoolean.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalNull.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalNumber.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalString.d.ts +10 -0
- package/dist/types/assertion/assertIsOptionalSymbol.d.ts +10 -0
- package/dist/types/assertion/assertIsPositiveFiniteNumber.d.ts +9 -0
- package/dist/types/assertion/assertIsPositiveInteger.d.ts +9 -0
- package/dist/types/assertion/assertIsPrimitive.d.ts +9 -0
- package/dist/types/assertion/assertIsPromiseFulfilledResult.d.ts +11 -0
- package/dist/types/assertion/assertIsPromiseRejectedResult.d.ts +11 -0
- package/dist/types/assertion/assertIsPropertyKey.d.ts +11 -0
- package/dist/types/assertion/assertIsSafeInteger.d.ts +9 -0
- package/dist/types/assertion/assertIsSizeAware.d.ts +9 -0
- package/dist/types/assertion/assertIsString.d.ts +9 -0
- package/dist/types/assertion/assertIsStringArray.d.ts +9 -0
- package/dist/types/assertion/assertIsStringMatching.d.ts +9 -0
- package/dist/types/assertion/assertIsStringRecord.d.ts +9 -0
- package/dist/types/assertion/assertIsStringWithLength.d.ts +9 -0
- package/dist/types/assertion/assertIsSymbol.d.ts +9 -0
- package/dist/types/assertion/assertIsSymbolArray.d.ts +9 -0
- package/dist/types/assertion/assertIsUndefined.d.ts +9 -0
- package/dist/types/assertion/assertIsUndefinedArray.d.ts +9 -0
- package/dist/types/assertion/assertPredicate.d.ts +11 -0
- package/dist/types/assertion/getError.d.ts +9 -0
- package/dist/types/capitalize.d.ts +9 -1
- package/dist/types/cartesian.d.ts +10 -0
- package/dist/types/chunk.d.ts +8 -0
- package/dist/types/clamp.d.ts +9 -0
- package/dist/types/combinations.d.ts +8 -0
- package/dist/types/comment.d.ts +8 -0
- package/dist/types/compose.d.ts +11 -0
- package/dist/types/convert.d.ts +8 -0
- package/dist/types/countCharCode.d.ts +8 -0
- package/dist/types/countCharacter.d.ts +8 -0
- package/dist/types/counter.d.ts +8 -0
- package/dist/types/dedent.d.ts +14 -0
- package/dist/types/deepDecodeURI.d.ts +8 -0
- package/dist/types/deepFreeze.d.ts +13 -0
- package/dist/types/describeInput.d.ts +10 -0
- package/dist/types/escapeRegExp.d.ts +8 -0
- package/dist/types/findIndentation.d.ts +8 -0
- package/dist/types/getDateString.d.ts +8 -0
- package/dist/types/getISODateString.d.ts +8 -0
- package/dist/types/getMaxValue.d.ts +8 -0
- package/dist/types/getMilliseconds.d.ts +9 -0
- package/dist/types/getMinValue.d.ts +8 -0
- package/dist/types/getOwnKeys.d.ts +8 -0
- package/dist/types/getOwnPaths.d.ts +8 -0
- package/dist/types/getOwnProperties.d.ts +8 -0
- package/dist/types/getPackageName.d.ts +9 -0
- package/dist/types/getPaths.d.ts +8 -0
- package/dist/types/getType.d.ts +9 -0
- package/dist/types/hasAdditionalProperties.d.ts +9 -0
- package/dist/types/inRange.d.ts +9 -0
- package/dist/types/isEmpty.d.ts +9 -0
- package/dist/types/iterateForever.d.ts +13 -0
- package/dist/types/joinStrings.d.ts +8 -0
- package/dist/types/looksLikeURL.d.ts +9 -0
- package/dist/types/memo.d.ts +14 -0
- package/dist/types/parseNumber.d.ts +9 -0
- package/dist/types/pathParts.d.ts +8 -0
- package/dist/types/predicate/assume.d.ts +13 -0
- package/dist/types/predicate/factory/allOf.d.ts +11 -0
- package/dist/types/predicate/factory/anyOf.d.ts +11 -0
- package/dist/types/predicate/factory/everyItem.d.ts +11 -0
- package/dist/types/predicate/factory/fromEnum.d.ts +17 -0
- package/dist/types/predicate/factory/instanceOf.d.ts +10 -0
- package/dist/types/predicate/factory/is.d.ts +10 -0
- package/dist/types/predicate/factory/literal.d.ts +10 -0
- package/dist/types/predicate/factory/matching.d.ts +10 -0
- package/dist/types/predicate/factory/maybeArray.d.ts +11 -0
- package/dist/types/predicate/factory/nonNullable.d.ts +13 -0
- package/dist/types/predicate/factory/nullable.d.ts +11 -0
- package/dist/types/predicate/factory/nullish.d.ts +12 -0
- package/dist/types/predicate/factory/optional.d.ts +11 -0
- package/dist/types/predicate/factory/shape.d.ts +13 -0
- package/dist/types/predicate/factory/simple.d.ts +10 -0
- package/dist/types/predicate/factory/stringLength.d.ts +11 -0
- package/dist/types/predicate/factory/tuple.d.ts +11 -0
- package/dist/types/predicate/factory/typeOf.d.ts +11 -0
- package/dist/types/predicate/index.d.ts +0 -1
- package/dist/types/predicate/isAny.d.ts +9 -0
- package/dist/types/predicate/isAnyObject.d.ts +9 -0
- package/dist/types/predicate/isAnyObjectWith.d.ts +9 -0
- package/dist/types/predicate/isAnyObjectWithOwn.d.ts +9 -0
- package/dist/types/predicate/isArray.d.ts +9 -0
- package/dist/types/predicate/isAsyncIterable.d.ts +12 -0
- package/dist/types/predicate/isBigInt.d.ts +9 -0
- package/dist/types/predicate/isBigIntArray.d.ts +9 -0
- package/dist/types/predicate/isBinaryNumberString.d.ts +11 -0
- package/dist/types/predicate/isBoolean.d.ts +9 -0
- package/dist/types/predicate/isBooleanArray.d.ts +9 -0
- package/dist/types/predicate/isDateInputString.d.ts +9 -0
- package/dist/types/predicate/isDigitsString.d.ts +9 -0
- package/dist/types/predicate/isFiniteNumber.d.ts +9 -0
- package/dist/types/predicate/isFunction.d.ts +9 -0
- package/dist/types/predicate/isHexNumberString.d.ts +11 -0
- package/dist/types/predicate/isISODateString.d.ts +12 -0
- package/dist/types/predicate/isInt32.d.ts +9 -0
- package/dist/types/predicate/isIntString.d.ts +9 -0
- package/dist/types/predicate/isInteger.d.ts +9 -0
- package/dist/types/predicate/isIterable.d.ts +9 -0
- package/dist/types/predicate/isJSONable.d.ts +9 -0
- package/dist/types/predicate/isLengthAware.d.ts +9 -0
- package/dist/types/predicate/isNonNullable.d.ts +9 -0
- package/dist/types/predicate/isNull.d.ts +9 -0
- package/dist/types/predicate/isNullArray.d.ts +9 -0
- package/dist/types/predicate/isNullish.d.ts +9 -0
- package/dist/types/predicate/isNumber.d.ts +9 -0
- package/dist/types/predicate/isNumberArray.d.ts +9 -0
- package/dist/types/predicate/isNumericString.d.ts +9 -0
- package/dist/types/predicate/isNumericValue.d.ts +9 -0
- package/dist/types/predicate/isNumericValueArray.d.ts +9 -0
- package/dist/types/predicate/isObject.d.ts +9 -0
- package/dist/types/predicate/isObjectLiteral.d.ts +9 -0
- package/dist/types/predicate/isObjectWith.d.ts +9 -0
- package/dist/types/predicate/isOctalNumberString.d.ts +11 -0
- package/dist/types/predicate/isOptionalArray.d.ts +9 -0
- package/dist/types/predicate/isOptionalBigInt.d.ts +9 -0
- package/dist/types/predicate/isOptionalBoolean.d.ts +9 -0
- package/dist/types/predicate/isOptionalISODateString.d.ts +9 -0
- package/dist/types/predicate/isOptionalNull.d.ts +9 -0
- package/dist/types/predicate/isOptionalNumber.d.ts +9 -0
- package/dist/types/predicate/isOptionalObject.d.ts +9 -0
- package/dist/types/predicate/isOptionalString.d.ts +9 -0
- package/dist/types/predicate/isOptionalSymbol.d.ts +9 -0
- package/dist/types/predicate/isPositiveFiniteNumber.d.ts +9 -0
- package/dist/types/predicate/isPositiveInteger.d.ts +9 -0
- package/dist/types/predicate/isPrimitive.d.ts +9 -0
- package/dist/types/predicate/isPromiseFulfilledResult.d.ts +9 -0
- package/dist/types/predicate/isPromiseLike.d.ts +9 -0
- package/dist/types/predicate/isPromiseRejectedResult.d.ts +9 -0
- package/dist/types/predicate/isPropertyKey.d.ts +9 -0
- package/dist/types/predicate/isSafeInteger.d.ts +9 -0
- package/dist/types/predicate/isSizeAware.d.ts +9 -0
- package/dist/types/predicate/isString.d.ts +9 -0
- package/dist/types/predicate/isStringArray.d.ts +9 -0
- package/dist/types/predicate/isStringRecord.d.ts +9 -0
- package/dist/types/predicate/isStringWithLength.d.ts +9 -0
- package/dist/types/predicate/isSymbol.d.ts +9 -0
- package/dist/types/predicate/isSymbolArray.d.ts +9 -0
- package/dist/types/predicate/isTimeoutError.d.ts +13 -0
- package/dist/types/predicate/isUInt32.d.ts +9 -0
- package/dist/types/predicate/isUndefined.d.ts +9 -0
- package/dist/types/predicate/isUndefinedArray.d.ts +9 -0
- package/dist/types/predicate/isUnknown.d.ts +9 -0
- package/dist/types/predicate/isUrlString.d.ts +9 -0
- package/dist/types/prefix.d.ts +9 -0
- package/dist/types/redactCredentialsInURL.d.ts +8 -0
- package/dist/types/resultify.d.ts +25 -0
- package/dist/types/secToString.d.ts +8 -0
- package/dist/types/sort/byLocaleCompare.d.ts +8 -0
- package/dist/types/sort/byRandom.d.ts +8 -0
- package/dist/types/sort/bySimpleComparison.d.ts +8 -0
- package/dist/types/sort/bySubtraction.d.ts +8 -0
- package/dist/types/sort/byTimestamp.d.ts +8 -0
- package/dist/types/sort/factory/byProperty.d.ts +8 -0
- package/dist/types/sort/factory/byReverseOf.d.ts +8 -0
- package/dist/types/stripIndent.d.ts +8 -0
- package/dist/types/stripWhitespace.d.ts +8 -0
- package/dist/types/suffix.d.ts +9 -0
- package/dist/types/toPascalCase.d.ts +9 -0
- package/dist/types/trimEnd.d.ts +9 -0
- package/dist/types/trimIndentation.d.ts +8 -0
- package/dist/types/trimStart.d.ts +9 -0
- package/dist/types/types/arrays.d.ts +3 -0
- package/dist/types/types/common.d.ts +3 -0
- package/dist/types/types/date-time.d.ts +9 -0
- package/dist/types/types/functions.d.ts +7 -0
- package/dist/types/types/numbers.d.ts +21 -0
- package/dist/types/types/objects.d.ts +74 -0
- package/dist/types/types/records.d.ts +5 -0
- package/dist/types/types/utils.d.ts +24 -0
- package/dist/types/unique.d.ts +18 -0
- package/dist/types/uniqueItems.d.ts +8 -0
- package/dist/types/until.d.ts +33 -0
- package/package.json +4 -2
- package/readme.md +11 -1
- package/dist/cjs/predicate/isDateString.js +0 -5
- package/dist/mjs/predicate/isDateString.js +0 -2
- package/dist/types/predicate/isDateString.d.ts +0 -2
package/dist/cjs/asArray.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asArray = asArray;
|
|
4
|
+
/**
|
|
5
|
+
* Ensure `data` is an array, wrapping it in one if it isn't already.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* asArray(1); // [1]
|
|
10
|
+
* asArray([1, 2]); // [1, 2]
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
function asArray(data) {
|
|
5
14
|
return Array.isArray(data) ? data : [data];
|
|
6
15
|
}
|
package/dist/cjs/asError.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asError = asError;
|
|
4
|
+
/**
|
|
5
|
+
* Ensure `input` is an `Error` instance, converting it to one if it isn't already.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* asError('Oops'); // Error('Oops')
|
|
10
|
+
* asError(new Error('Oops')); // the same Error instance
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
function asError(input) {
|
|
5
14
|
return input instanceof Error ? input : new Error(String(input));
|
|
6
15
|
}
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertExhaustive = assertExhaustive;
|
|
4
4
|
const getError_js_1 = require("./getError.js");
|
|
5
|
+
/**
|
|
6
|
+
* Assert that this line is unreachable, useful for exhaustive checks such as a `switch` covering every case of a union.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* type Direction = 'up' | 'down';
|
|
11
|
+
*
|
|
12
|
+
* function describe(direction: Direction): string {
|
|
13
|
+
* switch (direction) {
|
|
14
|
+
* case 'up':
|
|
15
|
+
* return 'Going up';
|
|
16
|
+
* case 'down':
|
|
17
|
+
* return 'Going down';
|
|
18
|
+
* default:
|
|
19
|
+
* assertExhaustive(direction); // throws if a new Direction case isn't handled above
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
5
24
|
function assertExhaustive(_, error = 'Failed exhaustive check') {
|
|
6
25
|
throw (0, getError_js_1.getError)(error);
|
|
7
26
|
}
|
|
@@ -3,6 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsAsyncIterable = assertIsAsyncIterable;
|
|
4
4
|
const isAsyncIterable_js_1 = require("../predicate/isAsyncIterable.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an `AsyncIterable`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* async function* gen() {
|
|
12
|
+
* yield 1;
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* assertIsAsyncIterable(gen()); // does not throw
|
|
16
|
+
* assertIsAsyncIterable([1, 2, 3]); // throws TypeError: input is not an AsyncIterable
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
6
19
|
function assertIsAsyncIterable(input, error = 'input is not an AsyncIterable') {
|
|
7
20
|
if (!(0, isAsyncIterable_js_1.isAsyncIterable)(input)) {
|
|
8
21
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsBigInt = assertIsBigInt;
|
|
4
4
|
const isBigInt_js_1 = require("../predicate/isBigInt.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a `bigint`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsBigInt(10n); // does not throw
|
|
12
|
+
* assertIsBigInt(10); // throws TypeError: input is not a bigint
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsBigInt(input, error = 'input is not a bigint') {
|
|
7
16
|
if (!(0, isBigInt_js_1.isBigInt)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsBigIntArray = assertIsBigIntArray;
|
|
4
4
|
const isBigIntArray_js_1 = require("../predicate/isBigIntArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of `bigint`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsBigIntArray([1n, 2n, 3n]); // does not throw
|
|
12
|
+
* assertIsBigIntArray([1, 2, 3]); // throws TypeError: input is not an array of bigint
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsBigIntArray(input, error = 'input is not an array of bigint') {
|
|
7
16
|
if (!(0, isBigIntArray_js_1.isBigIntArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsBoolean = assertIsBoolean;
|
|
4
4
|
const isBoolean_js_1 = require("../predicate/isBoolean.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a boolean.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsBoolean(true); // does not throw
|
|
12
|
+
* assertIsBoolean('true'); // throws TypeError: input is not a boolean
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsBoolean(input, error = 'input is not a boolean') {
|
|
7
16
|
if (!(0, isBoolean_js_1.isBoolean)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsBooleanArray = assertIsBooleanArray;
|
|
4
4
|
const isBooleanArray_js_1 = require("../predicate/isBooleanArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of booleans.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsBooleanArray([true, false]); // does not throw
|
|
12
|
+
* assertIsBooleanArray([true, 'false']); // throws TypeError: input is not an array of boolean
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsBooleanArray(input, error = 'input is not an array of boolean') {
|
|
7
16
|
if (!(0, isBooleanArray_js_1.isBooleanArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsDigitsString = assertIsDigitsString;
|
|
4
4
|
const isDigitsString_js_1 = require("../predicate/isDigitsString.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string that contains digits only.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsDigitsString('12345'); // does not throw
|
|
12
|
+
* assertIsDigitsString('123.45'); // throws TypeError: input is not a string of integers only
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsDigitsString(input, error = 'input is not a string of integers only') {
|
|
7
16
|
if (!(0, isDigitsString_js_1.isDigitsString)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsFiniteNumber = assertIsFiniteNumber;
|
|
4
4
|
const isFiniteNumber_js_1 = require("../predicate/isFiniteNumber.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a finite number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsFiniteNumber(42); // does not throw
|
|
12
|
+
* assertIsFiniteNumber(Infinity); // throws TypeError: input is not a finite number
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsFiniteNumber(input, error = 'input is not a finite number') {
|
|
7
16
|
if (!(0, isFiniteNumber_js_1.isFiniteNumber)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsFunction = assertIsFunction;
|
|
4
4
|
const isFunction_js_1 = require("../predicate/isFunction.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a function.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsFunction(() => {}); // does not throw
|
|
12
|
+
* assertIsFunction(42); // throws TypeError: input is not a function
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsFunction(input, error = 'input is not a function') {
|
|
7
16
|
if (!(0, isFunction_js_1.isFunction)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsInt32 = assertIsInt32;
|
|
4
4
|
const isInt32_js_1 = require("../predicate/isInt32.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a 32-bit integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsInt32(42); // does not throw
|
|
12
|
+
* assertIsInt32(2 ** 31); // throws TypeError: input is not an Int32
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsInt32(input, error = 'input is not an Int32') {
|
|
7
16
|
if (!(0, isInt32_js_1.isInt32)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsIntString = assertIsIntString;
|
|
4
4
|
const isIntString_js_1 = require("../predicate/isIntString.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string representing an integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsIntString('42'); // does not throw
|
|
12
|
+
* assertIsIntString('42.5'); // throws TypeError: input is not an integer string
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsIntString(input, error = 'input is not an integer string') {
|
|
7
16
|
if (!(0, isIntString_js_1.isIntString)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsInteger = assertIsInteger;
|
|
4
4
|
const isInteger_js_1 = require("../predicate/isInteger.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsInteger(42); // does not throw
|
|
12
|
+
* assertIsInteger(42.5); // throws TypeError: input is not an integer
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsInteger(input, error = 'input is not an integer') {
|
|
7
16
|
if (!(0, isInteger_js_1.isInteger)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsIterable = assertIsIterable;
|
|
4
4
|
const isIterable_js_1 = require("../predicate/isIterable.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an `Iterable`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsIterable<number>([1, 2, 3]); // does not throw
|
|
12
|
+
* assertIsIterable(42); // throws TypeError: input is not an Iterable
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsIterable(input, error = 'input is not an Iterable') {
|
|
7
16
|
if (!(0, isIterable_js_1.isIterable)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsLengthAware = assertIsLengthAware;
|
|
4
4
|
const isLengthAware_js_1 = require("../predicate/isLengthAware.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` has a numeric `length` property.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsLengthAware('hello'); // does not throw, strings have a numeric length
|
|
12
|
+
* assertIsLengthAware(42); // throws TypeError: input is not length aware
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsLengthAware(input, error = 'input is not length aware') {
|
|
7
16
|
if (!(0, isLengthAware_js_1.isLengthAware)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNull = assertIsNull;
|
|
4
4
|
const isNull_js_1 = require("../predicate/isNull.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is `null`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNull(null); // does not throw
|
|
12
|
+
* assertIsNull(undefined); // throws TypeError: input is not null
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNull(input, error = 'input is not null') {
|
|
7
16
|
if (!(0, isNull_js_1.isNull)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNullArray = assertIsNullArray;
|
|
4
4
|
const isNullArray_js_1 = require("../predicate/isNullArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of `null` values.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNullArray([null, null]); // does not throw
|
|
12
|
+
* assertIsNullArray([null, undefined]); // throws TypeError: input is not an array of null
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNullArray(input, error = 'input is not an array of null') {
|
|
7
16
|
if (!(0, isNullArray_js_1.isNullArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumber = assertIsNumber;
|
|
4
4
|
const isNumber_js_1 = require("../predicate/isNumber.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumber(42); // does not throw
|
|
12
|
+
* assertIsNumber('42'); // throws TypeError: input is not a number
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNumber(input, error = 'input is not a number') {
|
|
7
16
|
if (!(0, isNumber_js_1.isNumber)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumberArray = assertIsNumberArray;
|
|
4
4
|
const isNumberArray_js_1 = require("../predicate/isNumberArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of numbers.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumberArray([1, 2, 3]); // does not throw
|
|
12
|
+
* assertIsNumberArray([1, '2', 3]); // throws TypeError: input is not an array of number
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNumberArray(input, error = 'input is not an array of number') {
|
|
7
16
|
if (!(0, isNumberArray_js_1.isNumberArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumberGTEOne = assertIsNumberGTEOne;
|
|
4
4
|
const isPositiveFiniteNumber_js_1 = require("../predicate/isPositiveFiniteNumber.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a finite number greater than or equal to 1.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumberGTEOne(1); // does not throw
|
|
12
|
+
* assertIsNumberGTEOne(0.5); // throws TypeError: input is not a number >= 1
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNumberGTEOne(input, error = 'input is not a number >= 1') {
|
|
7
16
|
if (!(0, isPositiveFiniteNumber_js_1.isPositiveFiniteNumber)(input) || input < 1) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumericString = assertIsNumericString;
|
|
4
4
|
const isNumericString_js_1 = require("../predicate/isNumericString.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string representing a numeric value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumericString('3.14'); // does not throw
|
|
12
|
+
* assertIsNumericString('abc'); // throws TypeError: input is not a numeric string
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNumericString(input, error = 'input is not a numeric string') {
|
|
7
16
|
if (!(0, isNumericString_js_1.isNumericString)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumericValue = assertIsNumericValue;
|
|
4
4
|
const isNumericValue_js_1 = require("../predicate/isNumericValue.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a number, bigint, or numeric string.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumericValue(42); // does not throw
|
|
12
|
+
* assertIsNumericValue('42'); // does not throw
|
|
13
|
+
* assertIsNumericValue(42n); // does not throw
|
|
14
|
+
* assertIsNumericValue('abc'); // throws TypeError: input is not a numerical value
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
function assertIsNumericValue(input, error = 'input is not a numerical value') {
|
|
7
18
|
if (!(0, isNumericValue_js_1.isNumericValue)(input)) {
|
|
8
19
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsNumericValueArray = assertIsNumericValueArray;
|
|
4
4
|
const isNumericValueArray_js_1 = require("../predicate/isNumericValueArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of numbers, bigints, or numeric strings.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsNumericValueArray([1, '2', 3n]); // does not throw
|
|
12
|
+
* assertIsNumericValueArray([1, 'abc']); // throws TypeError: input is not a numerical value array
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsNumericValueArray(input, error = 'input is not a numerical value array') {
|
|
7
16
|
if (!(0, isNumericValueArray_js_1.isNumericValueArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsObject = assertIsObject;
|
|
4
4
|
const isObject_js_1 = require("../predicate/isObject.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an object.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsObject({ a: 1 }); // does not throw
|
|
12
|
+
* assertIsObject(null); // throws TypeError: input is not an object
|
|
13
|
+
* assertIsObject([1, 2, 3]); // throws TypeError: input is not an object
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsObject(input, error = 'input is not an object') {
|
|
7
17
|
if (!(0, isObject_js_1.isObject)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalBigInt = assertIsOptionalBigInt;
|
|
4
4
|
const isOptionalBigInt_js_1 = require("../predicate/isOptionalBigInt.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a `bigint` or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalBigInt(10n); // does not throw
|
|
12
|
+
* assertIsOptionalBigInt(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalBigInt(10); // throws TypeError: input is not an optional bigint
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalBigInt(input, error = 'input is not an optional bigint') {
|
|
7
17
|
if (!(0, isOptionalBigInt_js_1.isOptionalBigInt)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalBoolean = assertIsOptionalBoolean;
|
|
4
4
|
const isOptionalBoolean_js_1 = require("../predicate/isOptionalBoolean.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a boolean or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalBoolean(true); // does not throw
|
|
12
|
+
* assertIsOptionalBoolean(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalBoolean('true'); // throws TypeError: input is not an optional boolean
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalBoolean(input, error = 'input is not an optional boolean') {
|
|
7
17
|
if (!(0, isOptionalBoolean_js_1.isOptionalBoolean)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalNull = assertIsOptionalNull;
|
|
4
4
|
const isOptionalNull_js_1 = require("../predicate/isOptionalNull.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is `null` or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalNull(null); // does not throw
|
|
12
|
+
* assertIsOptionalNull(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalNull(0); // throws TypeError: input is not an optional null
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalNull(input, error = 'input is not an optional null') {
|
|
7
17
|
if (!(0, isOptionalNull_js_1.isOptionalNull)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalNumber = assertIsOptionalNumber;
|
|
4
4
|
const isOptionalNumber_js_1 = require("../predicate/isOptionalNumber.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a number or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalNumber(42); // does not throw
|
|
12
|
+
* assertIsOptionalNumber(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalNumber('42'); // throws TypeError: input is not an optional number
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalNumber(input, error = 'input is not an optional number') {
|
|
7
17
|
if (!(0, isOptionalNumber_js_1.isOptionalNumber)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalString = assertIsOptionalString;
|
|
4
4
|
const isOptionalString_js_1 = require("../predicate/isOptionalString.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalString('hello'); // does not throw
|
|
12
|
+
* assertIsOptionalString(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalString(42); // throws TypeError: input is not an optional string
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalString(input, error = 'input is not an optional string') {
|
|
7
17
|
if (!(0, isOptionalString_js_1.isOptionalString)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsOptionalSymbol = assertIsOptionalSymbol;
|
|
4
4
|
const isOptionalSymbol_js_1 = require("../predicate/isOptionalSymbol.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a symbol or `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsOptionalSymbol(Symbol('id')); // does not throw
|
|
12
|
+
* assertIsOptionalSymbol(undefined); // does not throw
|
|
13
|
+
* assertIsOptionalSymbol('id'); // throws TypeError: input is not an optional symbol
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
6
16
|
function assertIsOptionalSymbol(input, error = 'input is not an optional symbol') {
|
|
7
17
|
if (!(0, isOptionalSymbol_js_1.isOptionalSymbol)(input)) {
|
|
8
18
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPositiveFiniteNumber = assertIsPositiveFiniteNumber;
|
|
4
4
|
const isPositiveFiniteNumber_js_1 = require("../predicate/isPositiveFiniteNumber.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a positive, finite number.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsPositiveFiniteNumber(42); // does not throw
|
|
12
|
+
* assertIsPositiveFiniteNumber(-1); // throws TypeError: input is not a positive finite number
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsPositiveFiniteNumber(input, error = 'input is not a positive finite number') {
|
|
7
16
|
if (!(0, isPositiveFiniteNumber_js_1.isPositiveFiniteNumber)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPositiveInteger = assertIsPositiveInteger;
|
|
4
4
|
const isPositiveInteger_js_1 = require("../predicate/isPositiveInteger.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a positive integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsPositiveInteger(42); // does not throw
|
|
12
|
+
* assertIsPositiveInteger(-1); // throws TypeError: input is not a positive integer
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsPositiveInteger(input, error = 'input is not a positive integer') {
|
|
7
16
|
if (!(0, isPositiveInteger_js_1.isPositiveInteger)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPrimitive = assertIsPrimitive;
|
|
4
4
|
const isPrimitive_js_1 = require("../predicate/isPrimitive.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a primitive value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsPrimitive('hello'); // does not throw
|
|
12
|
+
* assertIsPrimitive({}); // throws TypeError: input is not primitive
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsPrimitive(input, error = 'input is not primitive') {
|
|
7
16
|
if (!(0, isPrimitive_js_1.isPrimitive)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPromiseFulfilledResult = assertIsPromiseFulfilledResult;
|
|
4
4
|
const isPromiseFulfilledResult_js_1 = require("../predicate/isPromiseFulfilledResult.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a fulfilled `Promise` result.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const [result] = await Promise.allSettled([Promise.resolve(42)]);
|
|
12
|
+
*
|
|
13
|
+
* assertIsPromiseFulfilledResult<number>(result); // does not throw
|
|
14
|
+
* assertIsPromiseFulfilledResult({ status: 'rejected' }); // throws TypeError: input is not a promise fulfilled result
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
function assertIsPromiseFulfilledResult(input, error = 'input is not a promise fulfilled result') {
|
|
7
18
|
if (!(0, isPromiseFulfilledResult_js_1.isPromiseFulfilledResult)(input)) {
|
|
8
19
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPromiseRejectedResult = assertIsPromiseRejectedResult;
|
|
4
4
|
const isPromiseRejectedResult_js_1 = require("../predicate/isPromiseRejectedResult.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a rejected `Promise` result.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const [result] = await Promise.allSettled([Promise.reject(new Error('fail'))]);
|
|
12
|
+
*
|
|
13
|
+
* assertIsPromiseRejectedResult(result); // does not throw
|
|
14
|
+
* assertIsPromiseRejectedResult({ status: 'fulfilled' }); // throws TypeError: input is not a promise rejected result
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
function assertIsPromiseRejectedResult(input, error = 'input is not a promise rejected result') {
|
|
7
18
|
if (!(0, isPromiseRejectedResult_js_1.isPromiseRejectedResult)(input)) {
|
|
8
19
|
throw (0, getError_js_1.getError)(error);
|