@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
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsPropertyKey = assertIsPropertyKey;
|
|
4
4
|
const isPropertyKey_js_1 = require("../predicate/isPropertyKey.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a valid property key: a string, number, or symbol.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsPropertyKey('key'); // does not throw
|
|
12
|
+
* assertIsPropertyKey(42); // does not throw
|
|
13
|
+
* assertIsPropertyKey(Symbol('key')); // does not throw
|
|
14
|
+
* assertIsPropertyKey({}); // throws TypeError: input is not a property key
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
function assertIsPropertyKey(input, error = 'input is not a property key') {
|
|
7
18
|
if (!(0, isPropertyKey_js_1.isPropertyKey)(input)) {
|
|
8
19
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsSafeInteger = assertIsSafeInteger;
|
|
4
4
|
const isSafeInteger_js_1 = require("../predicate/isSafeInteger.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a safe integer.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsSafeInteger(42); // does not throw
|
|
12
|
+
* assertIsSafeInteger(2 ** 53); // throws TypeError: input is not a safe integer
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsSafeInteger(input, error = 'input is not a safe integer') {
|
|
7
16
|
if (!(0, isSafeInteger_js_1.isSafeInteger)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsSizeAware = assertIsSizeAware;
|
|
4
4
|
const isSizeAware_js_1 = require("../predicate/isSizeAware.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` has a numeric `size` property.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsSizeAware(new Set([1, 2, 3])); // does not throw
|
|
12
|
+
* assertIsSizeAware(42); // throws TypeError: input is not size aware
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsSizeAware(input, error = 'input is not size aware') {
|
|
7
16
|
if (!(0, isSizeAware_js_1.isSizeAware)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsString = assertIsString;
|
|
4
4
|
const isString_js_1 = require("../predicate/isString.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsString('hello'); // does not throw
|
|
12
|
+
* assertIsString(42); // throws TypeError: input is not a string
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsString(input, error = 'input is not a string') {
|
|
7
16
|
if (!(0, isString_js_1.isString)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsStringArray = assertIsStringArray;
|
|
4
4
|
const isStringArray_js_1 = require("../predicate/isStringArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of strings.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsStringArray(['a', 'b']); // does not throw
|
|
12
|
+
* assertIsStringArray(['a', 42]); // throws TypeError: input is not an array of string
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsStringArray(input, error = 'input is not an array of string') {
|
|
7
16
|
if (!(0, isStringArray_js_1.isStringArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsStringMatching = assertIsStringMatching;
|
|
4
4
|
const matching_js_1 = require("../predicate/factory/matching.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a string that matches the given `pattern`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsStringMatching('hello', /^h/); // does not throw
|
|
12
|
+
* assertIsStringMatching('world', /^h/); // throws TypeError: input is not a string that matches the pattern
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsStringMatching(input, pattern, error = 'input is not a string that matches the pattern') {
|
|
7
16
|
if (!(0, matching_js_1.matching)(pattern)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsStringRecord = assertIsStringRecord;
|
|
4
4
|
const isStringRecord_js_1 = require("../predicate/isStringRecord.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an object whose own properties all have string values.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsStringRecord({ a: '1', b: '2' }); // does not throw
|
|
12
|
+
* assertIsStringRecord({ a: 1 }); // throws TypeError: input is not a string record
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsStringRecord(input, error = 'input is not a string record') {
|
|
7
16
|
if (!(0, isStringRecord_js_1.isStringRecord)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsStringWithLength = assertIsStringWithLength;
|
|
4
4
|
const isStringWithLength_js_1 = require("../predicate/isStringWithLength.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a non-empty string.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsStringWithLength('hello'); // does not throw
|
|
12
|
+
* assertIsStringWithLength(''); // throws TypeError: input is not a string with length
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsStringWithLength(input, error = 'input is not a string with length') {
|
|
7
16
|
if (!(0, isStringWithLength_js_1.isStringWithLength)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsSymbol = assertIsSymbol;
|
|
4
4
|
const isSymbol_js_1 = require("../predicate/isSymbol.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is a symbol.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsSymbol(Symbol('id')); // does not throw
|
|
12
|
+
* assertIsSymbol('id'); // throws TypeError: input is not a symbol
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsSymbol(input, error = 'input is not a symbol') {
|
|
7
16
|
if (!(0, isSymbol_js_1.isSymbol)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsSymbolArray = assertIsSymbolArray;
|
|
4
4
|
const isSymbolArray_js_1 = require("../predicate/isSymbolArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of symbols.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsSymbolArray([Symbol('a'), Symbol('b')]); // does not throw
|
|
12
|
+
* assertIsSymbolArray([Symbol('a'), 'b']); // throws TypeError: input is not an array of symbol
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsSymbolArray(input, error = 'input is not an array of symbol') {
|
|
7
16
|
if (!(0, isSymbolArray_js_1.isSymbolArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsUndefined = assertIsUndefined;
|
|
4
4
|
const isUndefined_js_1 = require("../predicate/isUndefined.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsUndefined(undefined); // does not throw
|
|
12
|
+
* assertIsUndefined(null); // throws TypeError: input is not undefined
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsUndefined(input, error = 'input is not undefined') {
|
|
7
16
|
if (!(0, isUndefined_js_1.isUndefined)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertIsUndefinedArray = assertIsUndefinedArray;
|
|
4
4
|
const isUndefinedArray_js_1 = require("../predicate/isUndefinedArray.js");
|
|
5
5
|
const getError_js_1 = require("./getError.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `input` is an array of `undefined` values.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertIsUndefinedArray([undefined, undefined]); // does not throw
|
|
12
|
+
* assertIsUndefinedArray([undefined, null]); // throws TypeError: input is not an array of undefined
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function assertIsUndefinedArray(input, error = 'input is not an array of undefined') {
|
|
7
16
|
if (!(0, isUndefinedArray_js_1.isUndefinedArray)(input)) {
|
|
8
17
|
throw (0, getError_js_1.getError)(error);
|
|
@@ -3,6 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertPathExists = assertPathExists;
|
|
4
4
|
const get_js_1 = require("../get.js");
|
|
5
5
|
const has_js_1 = require("../has.js");
|
|
6
|
+
/**
|
|
7
|
+
* Assert that `path` exists on `input`, optionally checking the value at that path with `predicate`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const input = { a: { b: 1 } };
|
|
12
|
+
*
|
|
13
|
+
* assertPathExists(input, 'a.b'); // does not throw
|
|
14
|
+
* assertPathExists(input, 'a.b', (value): value is number => typeof value === 'number'); // does not throw
|
|
15
|
+
* assertPathExists(input, 'c'); // throws Error: object path (c) does not exist on input
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
6
18
|
function assertPathExists(input, path, predicate) {
|
|
7
19
|
if (!(0, has_js_1.has)(input, path)) {
|
|
8
20
|
throw new Error(`object path (${path}) does not exist on input`);
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertPredicate = assertPredicate;
|
|
4
4
|
const getError_js_1 = require("./getError.js");
|
|
5
|
+
/**
|
|
6
|
+
* Assert that `input` satisfies the given `predicate`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const isNumber = (value: unknown): value is number => typeof value === 'number';
|
|
11
|
+
*
|
|
12
|
+
* assertPredicate(42, isNumber); // does not throw
|
|
13
|
+
* assertPredicate('42', isNumber); // throws TypeError: invalid input
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
5
16
|
function assertPredicate(input, predicate, error = 'invalid input') {
|
|
6
17
|
if (!predicate(input)) {
|
|
7
18
|
throw typeof error === 'function' ? error(input) : (0, getError_js_1.getError)(error);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getError = getError;
|
|
4
|
+
/**
|
|
5
|
+
* Get an `Error` instance from `error`, wrapping a string in a `TypeError`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* getError('Something went wrong'); // returns new TypeError('Something went wrong')
|
|
10
|
+
* getError(new RangeError('Out of range')); // returns the same RangeError instance
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
function getError(error) {
|
|
5
14
|
return error instanceof Error ? error : new TypeError(error);
|
|
6
15
|
}
|
package/dist/cjs/capitalize.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.capitalize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Capitalize the first letter of `word`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* capitalize('hello'); // 'Hello'
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
const capitalize = (word) => (word.substring(0, 1).toUpperCase() + word.substring(1));
|
|
5
13
|
exports.capitalize = capitalize;
|
package/dist/cjs/cartesian.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cartesian = cartesian;
|
|
4
|
+
/**
|
|
5
|
+
* Lazily yield the Cartesian product of the given arrays.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link https://en.wikipedia.org/wiki/Cartesian_product}
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* [...cartesian([1, 2], ['a', 'b'])]; // [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
4
14
|
function* cartesian(...input) {
|
|
5
15
|
const [head, ...tail] = input;
|
|
6
16
|
if (!Array.isArray(head)) {
|
package/dist/cjs/chunk.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chunk = chunk;
|
|
4
|
+
/**
|
|
5
|
+
* Split `items` into consecutive chunks of at most `chunkSize` items each.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* [...chunk([1, 2, 3, 4, 5], 2)]; // [[1, 2], [3, 4], [5]]
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
function* chunk(items, chunkSize) {
|
|
5
13
|
if (!Number.isSafeInteger(chunkSize) || chunkSize <= 0) {
|
|
6
14
|
throw new RangeError('Chunk size must be an integer greater than 0');
|
package/dist/cjs/clamp.js
CHANGED
|
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.clamp = clamp;
|
|
4
4
|
const getMaxValue_js_1 = require("./getMaxValue.js");
|
|
5
5
|
const getMinValue_js_1 = require("./getMinValue.js");
|
|
6
|
+
/**
|
|
7
|
+
* Clamp `value` so it falls between `min` and `max`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* clamp(0, 15, 10); // 10
|
|
12
|
+
* clamp(0, -5, 10); // 0
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
6
15
|
function clamp(min, value, max) {
|
|
7
16
|
return (0, getMaxValue_js_1.getMaxValue)(min, (0, getMinValue_js_1.getMinValue)(value, max));
|
|
8
17
|
}
|
package/dist/cjs/combinations.js
CHANGED
|
@@ -5,6 +5,14 @@ const asArray_js_1 = require("./asArray.js");
|
|
|
5
5
|
const cartesian_js_1 = require("./cartesian.js");
|
|
6
6
|
const isIterable_js_1 = require("./predicate/isIterable.js");
|
|
7
7
|
const isObject_js_1 = require("./predicate/isObject.js");
|
|
8
|
+
/**
|
|
9
|
+
* Generate every combination of `input`'s property values, recursing into nested objects.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* [...combinations({ a: [1, 2], b: 'x' })]; // [{ a: 1, b: 'x' }, { a: 2, b: 'x' }]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
8
16
|
function* combinations(input) {
|
|
9
17
|
const propertyNames = Object.keys(input);
|
|
10
18
|
const propertyValues = Object.values(input).map((value) => (0, isIterable_js_1.isIterable)(value)
|
package/dist/cjs/comment.js
CHANGED
|
@@ -9,6 +9,9 @@ var CommentType;
|
|
|
9
9
|
CommentType["Single"] = "single";
|
|
10
10
|
CommentType["HTML"] = "html";
|
|
11
11
|
})(CommentType || (exports.CommentType = CommentType = {}));
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
12
15
|
function getCommentParts(type) {
|
|
13
16
|
return {
|
|
14
17
|
[CommentType.Block]: {
|
|
@@ -37,6 +40,14 @@ function getCommentParts(type) {
|
|
|
37
40
|
},
|
|
38
41
|
}[type];
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Wrap `text` in a comment of the given `type`.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* comment('Hello\nWorld'); // '/**\n * Hello\n * World\n *\/'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
40
51
|
function comment(text, options) {
|
|
41
52
|
if (!text) {
|
|
42
53
|
return '';
|
package/dist/cjs/compose.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compose = compose;
|
|
4
|
+
/**
|
|
5
|
+
* Compose `functions` into a single function that pipes data through each of them in order.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const addOne = (n: number) => n + 1;
|
|
10
|
+
* const double = (n: number) => n * 2;
|
|
11
|
+
*
|
|
12
|
+
* compose(addOne, double)(3); // 8
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
function compose(...functions) {
|
|
5
16
|
return functions.reduce((prev, next) => (data, ...args) => {
|
|
6
17
|
const updatedData = prev(data, ...args);
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INDENT_CHAR_RAW_PATTERN = exports.NEWLINE_RAW_PATTERN = void 0;
|
|
4
|
+
// Longest-alternative-first so a lone `\r` from a CRLF pair is never matched on its own.
|
|
4
5
|
exports.NEWLINE_RAW_PATTERN = String.raw `\r\n|\r|\n`;
|
|
6
|
+
// Whitespace excluding line breaks, since those are matched separately via `NEWLINE`.
|
|
5
7
|
exports.INDENT_CHAR_RAW_PATTERN = String.raw `[^\S\r\n]`;
|
package/dist/cjs/convert.js
CHANGED
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convert = void 0;
|
|
4
4
|
const getOwnProperties_js_1 = require("./getOwnProperties.js");
|
|
5
5
|
const getType_js_1 = require("./getType.js");
|
|
6
|
+
/**
|
|
7
|
+
* Convert `input` using `converter`, which may be a function or a record of nested converters.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* convert({ name: 'Andy' }, { greeting: (data) => `Hi, ${data.name}` }); // { greeting: 'Hi, Andy' }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
6
14
|
const convert = (input, converter) => {
|
|
7
15
|
if (typeof converter === 'function') {
|
|
8
16
|
return converter(input);
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.countCharCode = countCharCode;
|
|
4
|
+
/**
|
|
5
|
+
* Count how many times `charCode` occurs in `input`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* countCharCode('hello', 'l'.charCodeAt(0)); // 2
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
function countCharCode(input, charCode) {
|
|
5
13
|
let count = 0;
|
|
6
14
|
for (let index = 0, length = input.length; index < length; ++index) {
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.countCharacter = countCharacter;
|
|
4
4
|
const countCharCode_js_1 = require("./countCharCode.js");
|
|
5
|
+
/**
|
|
6
|
+
* Count how many times `char` occurs in `input`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* countCharacter('hello', 'l'); // 2
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
function countCharacter(input, char) {
|
|
6
14
|
if (char.length !== 1) {
|
|
7
15
|
throw new Error('Expected a single character');
|
package/dist/cjs/counter.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.counter = counter;
|
|
4
|
+
/**
|
|
5
|
+
* Generate a sequence of numbers from `start` to `end`, incrementing by `step` each time.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* [...counter(1, 5)]; // [1, 2, 3, 4, 5]
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
function* counter(start = 0, end = Infinity, step = 1) {
|
|
5
13
|
if (step === 0) {
|
|
6
14
|
throw new TypeError('step cannot be zero');
|
package/dist/cjs/dedent.js
CHANGED
|
@@ -4,6 +4,20 @@ exports.dedent = void 0;
|
|
|
4
4
|
const constants_js_1 = require("./constants.js");
|
|
5
5
|
const findIndentation_js_1 = require("./findIndentation.js");
|
|
6
6
|
const stripIndent_js_1 = require("./stripIndent.js");
|
|
7
|
+
/**
|
|
8
|
+
* This is a tagged template function that removes common leading indentation from
|
|
9
|
+
* each line, re-indents any interpolated multi-line values to match, and trims
|
|
10
|
+
* leading/trailing whitespace from the result.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const value = 'World';
|
|
15
|
+
*
|
|
16
|
+
* dedent`
|
|
17
|
+
* Hello, ${value}!
|
|
18
|
+
* `; // 'Hello, World!'
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
7
21
|
const dedent = (raw, ...values) => {
|
|
8
22
|
const indent = (0, findIndentation_js_1.findIndentation)(raw);
|
|
9
23
|
if (!indent) {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deepDecodeURI = deepDecodeURI;
|
|
4
|
+
/**
|
|
5
|
+
* Repeatedly decode `uri` until decoding it no longer changes the value.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* deepDecodeURI('%2520'); // ' '
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
function deepDecodeURI(uri) {
|
|
5
13
|
if (!uri.length) {
|
|
6
14
|
return uri;
|
package/dist/cjs/deepFreeze.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deepFreeze = deepFreeze;
|
|
4
|
+
/**
|
|
5
|
+
* Deep freeze an object or array.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze}
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const frozen = deepFreeze({ nested: { value: 1 } });
|
|
12
|
+
*
|
|
13
|
+
* Object.isFrozen(frozen); // true
|
|
14
|
+
* Object.isFrozen(frozen.nested); // true
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
4
17
|
function deepFreeze(input, partialOptions = {}) {
|
|
5
18
|
const { filterProperties = new Set(['prototype', '__proto__']), doNotFreeze = new WeakSet([globalThis]), frozen = new WeakSet(), } = partialOptions;
|
|
6
19
|
if (doNotFreeze.has(input)) {
|
package/dist/cjs/delay.js
CHANGED
|
@@ -3,12 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.delay = delay;
|
|
4
4
|
const isPositiveInteger_js_1 = require("./predicate/isPositiveInteger.js");
|
|
5
5
|
const MAX_DELAY_MS = 2 ** 31 - 1;
|
|
6
|
+
/**
|
|
7
|
+
* Delay a specified number of milliseconds before resolving.
|
|
8
|
+
*
|
|
9
|
+
* The `ms` value can be between zero and the max delay value for `setTimeout()`, which is `2 ** 31 - 1`.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* await delay(1000); // resolves with `undefined` after 1 second
|
|
16
|
+
* await delay(1000, 'done'); // resolves with 'done' after 1 second
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
6
19
|
function delay(milliseconds, value, signal) {
|
|
7
20
|
return new Promise((resolve, reject) => {
|
|
8
21
|
if (!(0, isPositiveInteger_js_1.isPositiveInteger)(milliseconds)) {
|
|
9
22
|
reject(new TypeError('milliseconds must be a positive integer'));
|
|
10
23
|
return;
|
|
11
24
|
}
|
|
25
|
+
// `0` already checked above.
|
|
12
26
|
if (milliseconds > MAX_DELAY_MS) {
|
|
13
27
|
reject(new RangeError(`milliseconds must be between 0 and ${MAX_DELAY_MS}`));
|
|
14
28
|
return;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delayAnimationFrame = delayAnimationFrame;
|
|
4
|
+
/**
|
|
5
|
+
* Return a Promise that resolves with `value` on the next animation frame.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* await delayAnimationFrame(); // resolves with `undefined` on the next animation frame
|
|
10
|
+
* await delayAnimationFrame('done'); // resolves with 'done' on the next animation frame
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
function delayAnimationFrame(value) {
|
|
5
14
|
return new Promise((resolve) => {
|
|
6
15
|
window.requestAnimationFrame(() => resolve(value));
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delayAnimationFrames = delayAnimationFrames;
|
|
4
|
+
/**
|
|
5
|
+
* Return a Promise that resolves with `value` after the given number of animation `frames` have elapsed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* await delayAnimationFrames(5); // resolves with `undefined` after 5 animation frames
|
|
10
|
+
* await delayAnimationFrames(5, 'done'); // resolves with 'done' after 5 animation frames
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
function delayAnimationFrames(frames, value) {
|
|
5
14
|
return new Promise((resolve, reject) => {
|
|
6
15
|
if (!Number.isInteger(frames) || frames < 1) {
|
|
@@ -4,6 +4,16 @@ exports.describeInput = void 0;
|
|
|
4
4
|
const getType_js_1 = require("./getType.js");
|
|
5
5
|
const looksLikeURL_js_1 = require("./looksLikeURL.js");
|
|
6
6
|
const isNumericString_js_1 = require("./predicate/isNumericString.js");
|
|
7
|
+
/**
|
|
8
|
+
* Describe `input` with a short, human-readable label based on its type and shape.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* describeInput(true); // 'true'
|
|
13
|
+
* describeInput('https://example.com'); // 'https URL'
|
|
14
|
+
* describeInput(42); // 'Safe Integer'
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
7
17
|
const describeInput = (input) => {
|
|
8
18
|
switch (typeof input) {
|
|
9
19
|
case 'boolean':
|
|
@@ -49,6 +59,8 @@ const describeInput = (input) => {
|
|
|
49
59
|
if (Number.isNaN(input)) {
|
|
50
60
|
return 'NaN';
|
|
51
61
|
}
|
|
62
|
+
// Only remaining option is finite number, which we will
|
|
63
|
+
// call "Float" since we've already covered integers
|
|
52
64
|
return 'Float';
|
|
53
65
|
}
|
|
54
66
|
}
|
package/dist/cjs/escapeRegExp.js
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.escapeRegExp = escapeRegExp;
|
|
4
4
|
const pattern = /[.*+?^${}()|[\]\\]/g;
|
|
5
|
+
/**
|
|
6
|
+
* Escape RegExp special characters in `input`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* escapeRegExp('a.b*c'); // 'a\\.b\\*c'
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
function escapeRegExp(input) {
|
|
6
14
|
return input.length ? input.replace(pattern, '\\$&') : input;
|
|
7
15
|
}
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findIndentation = findIndentation;
|
|
4
4
|
const constants_js_1 = require("./constants.js");
|
|
5
|
+
/**
|
|
6
|
+
* Find indentation on first line that isn't whitespace only.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* findIndentation([' hello', ' world']); // ' '
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
function findIndentation(lines) {
|
|
6
14
|
return lines
|
|
7
15
|
.find((line) => !/^\s*$/.test(line))
|
package/dist/cjs/get.js
CHANGED
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.get = get;
|
|
4
4
|
const pathParts_js_1 = require("./pathParts.js");
|
|
5
|
+
/**
|
|
6
|
+
* Get the value at `path` within `input`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* get({ a: { b: 1 } }, 'a.b'); // 1
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
function get(input, path) {
|
|
6
14
|
if (path === '') {
|
|
7
15
|
return input;
|
|
8
16
|
}
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
18
|
let current = input;
|
|
10
19
|
for (const part of (0, pathParts_js_1.pathParts)(path)) {
|
|
11
20
|
if (typeof current === 'object' && current !== null && part in current) {
|