@webdeveric/utils 0.83.0 → 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 +16 -1
- 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 +16 -1
- 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 +13 -1
- 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 +24 -1
- 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 +15 -12
- 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
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describe `input` with a short, human-readable label based on its type and shape.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* describeInput(true); // 'true'
|
|
7
|
+
* describeInput('https://example.com'); // 'https URL'
|
|
8
|
+
* describeInput(42); // 'Safe Integer'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
export declare const describeInput: (input: unknown) => string;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { DateInput, DateString } from './types/date-time.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the date portion (`YYYY-MM-DD`) of `value` as a date string.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* getDateString(new Date('2024-01-15T10:30:00Z')); // '2024-01-15'
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export declare const getDateString: (value?: DateInput) => DateString;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { DateInput, ISODateString } from './types/date-time.js';
|
|
2
|
+
/**
|
|
3
|
+
* Convert `value` to an ISO 8601 date string.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* getISODateString(new Date('2024-01-15T10:30:00Z')); // '2024-01-15T10:30:00.000Z'
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export declare const getISODateString: (value?: DateInput) => ISODateString;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { NumericValue } from './types/common.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the largest value among `values`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* getMaxValue(1, 5, 3); // 5
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export declare function getMaxValue<T extends NumericValue>(...values: [T, ...T[]]): T;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { NumericValue } from './types/common.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the smallest value among `values`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* getMinValue(1, 5, 3); // 1
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export declare function getMinValue<T extends NumericValue>(...values: [T, ...T[]]): T;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { Path } from './types/objects.js';
|
|
2
2
|
import type { AnyRecord } from './types/records.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get all own property paths of `input`, including dot-separated paths for nested objects.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* getOwnPaths({ a: 1, b: { c: 2 } }); // ['a', 'b', 'b.c']
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
export declare const getOwnPaths: <Type extends AnyRecord>(input: Type) => Path<Type>[];
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract the package name, including any scope, from `input`.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* getPackageName('@scope/name/sub/path'); // '@scope/name'
|
|
7
|
+
* getPackageName('lodash/fp'); // 'lodash'
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare function getPackageName(input: string): string | undefined;
|
package/dist/types/getPaths.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { Path } from './types/objects.js';
|
|
2
2
|
import type { AnyRecord } from './types/records.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get every property path in `input`, including nested paths.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* getPaths({ a: 1, b: { c: 2 } }); // ['a', 'b', 'b.c']
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
3
11
|
export declare const getPaths: <Type extends AnyRecord>(input: Type) => Path<Type>[];
|
package/dist/types/getType.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine if the `input` object has properties other than the provided `knownProperties`.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* hasAdditionalProperties({ a: 1, b: 2 }, ['a']); // true
|
|
7
|
+
* hasAdditionalProperties({ a: 1 }, ['a']); // false
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare const hasAdditionalProperties: (input: object, knownProperties: PropertyKey[]) => boolean;
|
package/dist/types/inRange.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine if `input` is a number or bigint between `min` and `max`, inclusive.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* inRange(5, 1, 10); // true
|
|
7
|
+
* inRange(15, 1, 10); // false
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare const inRange: (input: unknown, min: number | bigint, max: number | bigint) => boolean;
|
package/dist/types/isEmpty.d.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repeatedly yield the items in `items`, looping forever.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const iterator = iterateForever([1, 2, 3]);
|
|
7
|
+
*
|
|
8
|
+
* iterator.next().value; // 1
|
|
9
|
+
* iterator.next().value; // 2
|
|
10
|
+
* iterator.next().value; // 3
|
|
11
|
+
* iterator.next().value; // 1
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export declare function iterateForever<T>(items: Iterable<T>): Generator<T, undefined, undefined>;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join `left` and `right` with `separator`, without duplicating the separator at the seam.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* joinStrings('a/', '/b'); // 'a/b'
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
1
9
|
export declare function joinStrings(left: string, right: string, separator?: string): string;
|
package/dist/types/memo.d.ts
CHANGED
|
@@ -4,5 +4,19 @@ export type DefaultCacheKeyFn<Fn extends AnyFunction> = CacheKeyFn<Fn, NonNullab
|
|
|
4
4
|
export type MemoizedFn<Fn extends AnyFunction, CkFn extends CacheKeyFn<Fn>> = Fn & {
|
|
5
5
|
cache: Map<ReturnType<CkFn>, ReturnType<Fn>>;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Memoize a function
|
|
9
|
+
*
|
|
10
|
+
* @privateRemarks
|
|
11
|
+
* TODO: use `Map.getOrInsertComputed()` once it is widely available.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const square = memo((n: number) => n * n);
|
|
16
|
+
*
|
|
17
|
+
* square(4); // 16, computed and cached
|
|
18
|
+
* square(4); // 16, returned from the cache
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
7
21
|
export declare function memo<Fn extends AnyFunction, CkFn extends CacheKeyFn<Fn>>(fn: Fn, getCacheKey: CkFn): MemoizedFn<Fn, CkFn>;
|
|
8
22
|
export declare function memo<Fn extends AnyFunction>(fn: Fn): MemoizedFn<Fn, DefaultCacheKeyFn<Fn>>;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function is used to create a type guard that always returns true, effectively allowing
|
|
3
|
+
* the input to be treated as the specified type without any runtime checks.
|
|
4
|
+
*
|
|
5
|
+
* @privateRemarks
|
|
6
|
+
* The `is` prefix is omitted because there is not any conditional logic in the function.
|
|
7
|
+
* It is more of a command to `tsc` to assume the type rather than a check.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* assume<string>(42); // true (no runtime check is performed)
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export declare const assume: <Type>(_input: unknown, ..._args: any[]) => _input is Type;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { NonEmptyArray } from '../../types/arrays.js';
|
|
2
2
|
import type { InferPredicatesReturnType, TypePredicateFn } from '../../types/functions.js';
|
|
3
3
|
import type { IntersectionOf } from '../../types/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* All predicates must pass
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const isPositiveInteger = allOf(isNumber, isInteger, (input: unknown): input is number => (input as number) > 0);
|
|
10
|
+
* isPositiveInteger(5); // true
|
|
11
|
+
* isPositiveInteger(-5); // false
|
|
12
|
+
* isPositiveInteger(1.5); // false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
export declare const allOf: <Predicates extends NonEmptyArray<TypePredicateFn<unknown>>>(...predicates: Predicates) => TypePredicateFn<IntersectionOf<InferPredicatesReturnType<Predicates>>>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { NonEmptyArray } from '../../types/arrays.js';
|
|
2
2
|
import type { InferPredicatesReturnType, TypePredicateFn } from '../../types/functions.js';
|
|
3
3
|
import type { UnionOf } from '../../types/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Any predicate can pass
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const isStringOrNumber = anyOf(isString, isNumber);
|
|
10
|
+
* isStringOrNumber('hello'); // true
|
|
11
|
+
* isStringOrNumber(5); // true
|
|
12
|
+
* isStringOrNumber(true); // false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
export declare const anyOf: <Predicates extends NonEmptyArray<TypePredicateFn<unknown>>>(...predicates: Predicates) => TypePredicateFn<UnionOf<InferPredicatesReturnType<Predicates>>>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks if `input` is an array whose every item passes the given `predicate`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isStringArray = everyItem(isString);
|
|
8
|
+
* isStringArray(['a', 'b', 'c']); // true
|
|
9
|
+
* isStringArray(['a', 1, 'c']); // false
|
|
10
|
+
* isStringArray('a'); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const everyItem: <Type>(predicate: TypePredicateFn<Type>) => TypePredicateFn<Type[]>;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
2
|
import type { EnumRecord } from '../../types/records.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a type predicate function that checks if the input is a member of the TypeScript `enum`
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* enum Color {
|
|
9
|
+
* Red,
|
|
10
|
+
* Green,
|
|
11
|
+
* Blue,
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* const isColor = fromEnum(Color);
|
|
15
|
+
* isColor(Color.Red); // true
|
|
16
|
+
* isColor(0); // true
|
|
17
|
+
* isColor(3); // false
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export declare const fromEnum: <T extends EnumRecord>(enumObject: T) => TypePredicateFn<T[keyof T]>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { AnyNewable } from '../../types/common.js';
|
|
2
2
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a type predicate function that checks if `input` is an instance of the given `constructor`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const isDate = instanceOf(Date);
|
|
9
|
+
* isDate(new Date()); // true
|
|
10
|
+
* isDate('2024-01-01'); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export declare const instanceOf: <T extends AnyNewable>(constructor: T) => TypePredicateFn<InstanceType<T>>;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
import type { NonEmptyArray } from '../../types/arrays.js';
|
|
1
2
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
-
|
|
3
|
+
import type { UnionOf } from '../../types/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Use `Object.is()` to compare `input` against allowed values.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const isRedGreenOrBlue = is('red', 'green', 'blue');
|
|
10
|
+
* isRedGreenOrBlue('red'); // true
|
|
11
|
+
* isRedGreenOrBlue('yellow'); // false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const is: <const Values extends NonEmptyArray<unknown>>(...values: Values) => TypePredicateFn<UnionOf<Values>>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks if `input` strictly equals the given `value`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isFoo = literal('foo');
|
|
8
|
+
* isFoo('foo'); // true
|
|
9
|
+
* isFoo('bar'); // false
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
2
12
|
export declare const literal: <const Type>(value: Type) => TypePredicateFn<Type>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks if `input` is a string matching the given `pattern`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isHexColor = matching(/^#[0-9a-f]{6}$/i);
|
|
8
|
+
* isHexColor('#ff0000'); // true
|
|
9
|
+
* isHexColor('red'); // false
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
2
12
|
export declare const matching: <T extends string>(pattern: RegExp) => TypePredicateFn<T>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks `input` against `predicate`, applying it to every item when `input` is an array.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isStringOrStringArray = maybeArray(isString);
|
|
8
|
+
* isStringOrStringArray('hello'); // true
|
|
9
|
+
* isStringOrStringArray(['a', 'b']); // true
|
|
10
|
+
* isStringOrStringArray(['a', 1]); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const maybeArray: <T>(predicate: TypePredicateFn<T>) => TypePredicateFn<T | T[]>;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that passes if `input` is not `null`/`undefined` and passes the given `predicate`.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype}
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const isNonNullableString = nonNullable(isString);
|
|
10
|
+
* isNonNullableString('hello'); // true
|
|
11
|
+
* isNonNullableString(null); // false
|
|
12
|
+
* isNonNullableString(undefined); // false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
2
15
|
export declare const nonNullable: <T>(predicate: TypePredicateFn<T>) => TypePredicateFn<NonNullable<T>>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that passes if `input` is `null` or passes the given `predicate`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isNullableString = nullable(isString);
|
|
8
|
+
* isNullableString('hello'); // true
|
|
9
|
+
* isNullableString(null); // true
|
|
10
|
+
* isNullableString(undefined); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const nullable: <T>(predicate: TypePredicateFn<T>) => TypePredicateFn<T | null>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { Nullish } from '../../types/common.js';
|
|
2
2
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a type predicate function that passes if `input` is `null`, `undefined`, or passes the given `predicate`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const isNullishString = nullish(isString);
|
|
9
|
+
* isNullishString('hello'); // true
|
|
10
|
+
* isNullishString(null); // true
|
|
11
|
+
* isNullishString(undefined); // true
|
|
12
|
+
* isNullishString(5); // false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
3
15
|
export declare const nullish: <T>(predicate: TypePredicateFn<T>) => TypePredicateFn<Nullish<T>>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that passes if `input` is `undefined` or passes the given `predicate`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isOptionalString = optional(isString);
|
|
8
|
+
* isOptionalString('hello'); // true
|
|
9
|
+
* isOptionalString(undefined); // true
|
|
10
|
+
* isOptionalString(null); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const optional: <T>(predicate: TypePredicateFn<T>) => TypePredicateFn<T | undefined>;
|
|
@@ -11,4 +11,17 @@ export type InferTypeFromShapeValue<Type> = Type extends RegExp ? string : Type
|
|
|
11
11
|
export type InferTypeFromShape<Shape extends ObjectShapeRecord<object>> = {
|
|
12
12
|
[Property in keyof Shape]: InferTypeFromShapeValue<Shape[Property]>;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Create a type predicate function that checks if `input` is an object matching the given `objectShape`. Set `additionalProperties` to `false` to reject objects with extra properties.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const isPerson = shape({ name: isString, age: isNumber });
|
|
20
|
+
* isPerson({ name: 'Andy', age: 30 }); // true
|
|
21
|
+
* isPerson({ name: 'Andy' }); // false
|
|
22
|
+
*
|
|
23
|
+
* const isStrictPerson = shape({ name: isString, age: isNumber }, false);
|
|
24
|
+
* isStrictPerson({ name: 'Andy', age: 30, extra: true }); // false
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
14
27
|
export declare const shape: <Type extends object, Shape extends ObjectShapeRecord<Type> = ObjectShapeRecord<Type>>(objectShape: Shape, additionalProperties?: boolean) => TypePredicateFn<Pretty<Type & InferTypeFromShape<Shape>>>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { InferPredicateReturnType, TypePredicateFn } from '../../types/functions.js';
|
|
2
2
|
export type Simple<Type> = Type extends string ? string : Type extends number ? number : Type extends boolean ? boolean : Type extends bigint ? bigint : Type extends symbol ? symbol : Type extends undefined ? undefined : Type extends null ? null : Type extends Function ? Function : Type extends unknown[] ? unknown[] : Type extends object ? object : never;
|
|
3
|
+
/**
|
|
4
|
+
* Create a type predicate function that narrows the result of `fn` down to its simple (non-branded) type.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const isSimpleNumber = simple(isInt32); // narrows from branded `Int32` down to plain `number`
|
|
9
|
+
* isSimpleNumber(5); // true
|
|
10
|
+
* isSimpleNumber('5'); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export declare const simple: <Fn extends TypePredicateFn<unknown>>(fn: Fn) => TypePredicateFn<Simple<InferPredicateReturnType<Fn>>>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypePredicateFn } from '../../types/functions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks if `input` is a string whose length is between `min` and `max`, inclusive.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isShortString = stringLength(1, 10);
|
|
8
|
+
* isShortString('hello'); // true
|
|
9
|
+
* isShortString(''); // false
|
|
10
|
+
* isShortString('this is too long'); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const stringLength: <Type extends string = string>(min: number, max?: number) => TypePredicateFn<Type>;
|
|
@@ -4,4 +4,15 @@ export type TuplePredicateInput = (Primitive | TypePredicateFn<unknown>)[];
|
|
|
4
4
|
export type GetTupleFromInput<Type extends TuplePredicateInput> = {
|
|
5
5
|
[Property in keyof Type]: Type[Property] extends TypePredicateFn<infer T> ? T : Type[Property];
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Create a type predicate function that checks if `input` is an array matching the given `tupleShape`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const isNameAgeTuple = tuple([isString, isNumber]);
|
|
13
|
+
* isNameAgeTuple(['Andy', 30]); // true
|
|
14
|
+
* isNameAgeTuple([30, 'Andy']); // false
|
|
15
|
+
* isNameAgeTuple(['Andy', 30, 'extra']); // false
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
7
18
|
export declare const tuple: <const Input extends TuplePredicateInput>(tupleShape: Input) => TypePredicateFn<GetTupleFromInput<Input>>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { TypeOf, TypeOfMapping } from '../../types/common.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a type predicate function that checks if `input`'s `typeof` matches one of the given `types`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const isStringOrNumber = typeOf('string', 'number');
|
|
8
|
+
* isStringOrNumber('hello'); // true
|
|
9
|
+
* isStringOrNumber(5); // true
|
|
10
|
+
* isStringOrNumber(true); // false
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const typeOf: <T extends TypeOf>(...types: T[]) => <Input>(input: Input) => input is Input & TypeOfMapping[T];
|
|
@@ -11,7 +11,6 @@ export * from './isBinaryNumberString.js';
|
|
|
11
11
|
export * from './isBoolean.js';
|
|
12
12
|
export * from './isBooleanArray.js';
|
|
13
13
|
export * from './isDateInputString.js';
|
|
14
|
-
export * from './isDateString.js';
|
|
15
14
|
export * from './isDigitsString.js';
|
|
16
15
|
export * from './isFiniteNumber.js';
|
|
17
16
|
export * from './isFunction.js';
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine if `input` is an object and has the provided properties.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* isAnyObjectWith({ a: 1, b: 2 }, ['a', 'b']); // true
|
|
7
|
+
* isAnyObjectWith({ a: 1 }, ['a', 'b']); // false
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare const isAnyObjectWith: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine if `input` is an object and directly has the provided properties.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* isAnyObjectWithOwn({ a: 1 }, ['a']); // true
|
|
7
|
+
* isAnyObjectWithOwn(Object.create({ a: 1 }), ['a']); // false
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare const isAnyObjectWithOwn: <T, P extends PropertyKey>(input: T, properties: P[]) => input is T & Record<P, unknown>;
|