typedash
Version:
modern, type-safe collection of utility functions
1 lines • 133 kB
Source Map (JSON)
{"version":3,"sources":["../src/functions/compact/compact.ts","../src/functions/assert/assert.ts","../src/functions/assertNever/assertNever.ts","../src/functions/capitalize/capitalize.ts","../src/functions/camelCase/camelCase.ts","../src/functions/isArray/isArray.ts","../src/functions/castArrayIfDefined/castArrayIfDefined.ts","../src/functions/castArray/castArray.ts","../src/functions/chunk/chunk.ts","../src/functions/clamp/clamp.ts","../src/functions/constantCase/constantCase.ts","../src/functions/_internal/filterIterable/filterIterable.ts","../src/functions/count/count.ts","../src/functions/createTypeGuard/createTypeGuard.ts","../src/functions/debounce/debounce.ts","../src/functions/negate/negate.ts","../src/functions/difference/difference.ts","../src/functions/ensurePrefix/ensurePrefix.ts","../src/functions/ensureSuffix/ensureSuffix.ts","../src/functions/hasKey/hasKey.ts","../src/functions/get/get.ts","../src/functions/groupBy/groupBy.ts","../src/functions/identity/identity.ts","../src/functions/inRange/inRange.ts","../src/functions/intersection/intersection.ts","../src/functions/invert/invert.ts","../src/functions/isEmpty/isEmpty.ts","../src/functions/zip/zip.ts","../src/functions/isEqual/_internal/array/areArraysEqual.ts","../src/functions/isEqual/_internal/createIsCircularTypeEqualityComparator.ts","../src/functions/isEqual/_internal/date/areDatesEqual.ts","../src/functions/isEqual/_internal/date/dateTag.ts","../src/functions/isEqual/_internal/map/areMapsEqual.ts","../src/functions/isEqual/_internal/react/reactOwnerPropertyName.ts","../src/functions/isEqual/_internal/object/getObjectProperties.ts","../src/functions/isEqual/_internal/object/areObjectsEqual.ts","../src/functions/isEqual/_internal/primitiveWrappers/arePrimitiveWrappersEqual.ts","../src/functions/isEqual/_internal/regExp/areRegExpsEqual.ts","../src/functions/isEqual/_internal/regExp/regExpTag.ts","../src/functions/isEqual/_internal/set/areSetsEqual.ts","../src/functions/isEqual/_internal/set/setTag.ts","../src/functions/isEqual/_internal/typedArray/areTypedArraysEqual.ts","../src/functions/isEqual/_internal/typedArray/isTypedArray.ts","../src/functions/isEqual/_internal/comparator.ts","../src/functions/isEqual/_internal/createEqualityComparator.ts","../src/functions/isEqual/isEqual.ts","../src/functions/isNonNullable/isNonNullable.ts","../src/functions/join/join.ts","../src/functions/kebabCase/kebabCase.ts","../src/functions/keyBy/keyBy.ts","../src/functions/objectEntries/objectEntries.ts","../src/functions/objectFromEntries/objectFromEntries.ts","../src/functions/mapKeys/mapKeys.ts","../src/functions/mapValues/mapValues.ts","../src/functions/max/max.ts","../src/functions/memoize/memoize.ts","../src/functions/min/min.ts","../src/functions/noop/noop.ts","../src/functions/objectKeys/objectKeys.ts","../src/functions/_internal/filterObject/createObjectPredicate.ts","../src/functions/_internal/filterObject/filterObject.ts","../src/functions/omit/omit.ts","../src/functions/once/once.ts","../src/functions/orderBy/orderBy.ts","../src/functions/partition/partition.ts","../src/functions/pick/pick.ts","../src/functions/pipe/pipe.ts","../src/functions/range/range.ts","../src/functions/sample/sample.ts","../src/functions/_internal/isMaliciousObjectPath.ts","../src/functions/set/set.ts","../src/functions/single/single.ts","../src/functions/sum/sum.ts","../src/functions/take/take.ts","../src/functions/toObject/toObject.ts","../src/functions/unique/unique.ts","../src/functions/uniqueId/uniqueId.ts","../src/functions/without/without.ts"],"names":["range","min","max","isEqual","areArraysEqual","areDatesEqual","areMapsEqual","areObjectsEqual","arePrimitiveWrappersEqual","areRegExpsEqual","areSetsEqual","areTypedArraysEqual","count"],"mappings":";AAYO,SAAS,QAAW,OAA8C;AACvE,SAAQ,OAAO,OAAO,OAAO,KAAyB,CAAC;AACzD;;;ACSO,SAAS,OACd,WACA,SACmB;AACnB,MAAI,UAAU,WAAW,GAAG;AAC1B;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,eAAe,OAAO;AAAA,EAClC;AACF;AAMO,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAkB;AAC5B;AAAA,MACE,QAAQ;AAAA,QACN;AAAA,QACA,UAAU,MAAM,OAAO,MAAM;AAAA,MA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O;AAC3B,SAAO,OAAO,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE;AACxC;;;ACnCO,SAAS,QACd,OACA,gBACsB;AACtB,QAAM,kBAAkB,gBAAgB,cAAc;AACtD,SAAO,MAAM,OAAO,CAAC,SAAgC,CAAC,gBAAgB,IAAI,CAAC;AAC7E","sourcesContent":["import { Falsey, Maybe } from '../../types';\n\n/**\n * Creates an array with all falsey values removed.\n * The values `false`, `null`, `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n * @param array The array to compact.\n * @returns The new array of filtered values.\n * @example\n * ```ts\n * compact([0, 1, false, 2, '', 3, null, 4, undefined]) // [1, 2, 3, 4]\n * ```\n */\nexport function compact<T>(array: Maybe<ReadonlyArray<T | Falsey>>): T[] {\n return (array?.filter(Boolean) as T[] | undefined) ?? [];\n}\n","import { compact } from '../compact';\n\n/**\n * Asserts that a condition is true, throwing an Error if it is not.\n * @param condition A condition that should be true\n * @param message A message to use in the Error that will be thrown if the condition is falsy\n * @throws An `AssertionError` if the condition is falsy\n * @example\n * ```ts\n * function doWork(value: number | undefined) {\n * assert(value !== undefined, 'value should be defined');\n * // value is now narrowed to number\n *\n * return value + 1;\n * }\n * ```\n * @example\n * ```ts\n * assert(1 === 1); // OK\n * assert(1 === 2); // throws AssertionError\n * assert(1 === 2, '1 should equal 2'); // throws AssertionError: 1 should equal 2\n * ```\n */\nexport function assert(\n condition?: unknown,\n message?: string\n): asserts condition {\n if (arguments.length === 0) {\n return;\n }\n\n if (!condition) {\n throw new AssertionError(message);\n }\n}\n\n/**\n * An error that is thrown when an assertion is not satisfied.\n * Thrown by {@link assert}.\n */\nexport class AssertionError extends Error {\n constructor(message?: string) {\n super(\n compact([\n `Assertion not satisfied`,\n message ? `: \"${message}\"` : '',\n ]).join('')\n );\n }\n}\n","/**\n * Throws an error if a value is of type `never`.\n * Used for exhaustive checks.\n * @param inclusive The value to check.\n * @param noThrow If `true`, returns `undefined` instead of throwing an error.\n * @returns This function never returns a value, but throws an error if `inclusive` is of type `never`.\n * @example\n * ```typescript\n * assertNever('foo' as never); // throws an error\n * assertNever('foo' as never, true); // returns undefined\n * ```\n */\nexport function assertNever(inclusive: never, noThrow = false): never {\n if (noThrow) {\n return undefined as never;\n }\n\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- this is unexpected to happen, but if it does, it's better to have the value.\n throw new Error(`Unexpected inclusive value: ${inclusive}`);\n}\n","/**\n * Returns a new string with the first character capitalized.\n * @param string The input string to capitalize.\n * @returns A new string with the first character capitalized.\n * @example\n * ```ts\n * capitalize('foo'); // 'Foo'\n * capitalize(''); // ''\n * ```\n */\nexport function capitalize<S extends string>(string: S): Capitalize<S> {\n return `${string.charAt(0).toUpperCase()}${string.slice(1)}` as Capitalize<S>;\n}\n","import type { CamelCase as CamelCaseImplementation } from 'type-fest';\n\nimport { capitalize } from '../capitalize';\n\n/**\n * Changes the casing of a string to kebab case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to kebab case.\n * @example\n * ```ts\n * camelCase('fooBar') // 'fooFar'\n * camelCase('foo bar') // 'fooBar'\n * camelCase('foo-bar') // 'fooBar'\n * camelCase('fooBar42') // 'fooBar42'\n * ```\n */\nexport function camelCase<S extends string>(string: S): CamelCase<S> {\n if (!/[a-z]+/i.test(string)) {\n return string as CamelCase<S>;\n }\n\n const words = string.trim().split(wordsRegex);\n return words\n .map((word, index) => (index === 0 ? word.toLowerCase() : capitalize(word)))\n .join('') as CamelCase<S>;\n}\n\n/**\n * Changes the casing of a string to camel case.\n * @see {@link camelCase}.\n */\nexport type CamelCase<S extends string> = CamelCaseImplementation<S>;\n\nconst wordsRegex = /[\\s_-]+|(?<=[a-z])(?=[A-Z])/;\n","import { Many, Maybe } from '../../types';\n\n// eslint-disable-next-line prefer-destructuring\nexport const isArray: IsArray = Array.isArray;\n\ninterface IsArray {\n /**\n * The same as `Array.isArray` but with a better type guard.\n * @param value The value to check.\n * @returns `true` if the value is an array, `false` otherwise.\n * @example\n * ```ts\n * isArray([1, 2, 3]) // true\n * isArray('foo') // false\n * ```\n */\n <T>(value: Maybe<Array<ArrayElement<T>>>): value is NonNullable<typeof value>;\n /**\n * The same as `Array.isArray` but with a better type guard.\n * @param value The value to check.\n * @returns `true` if the value is an array, `false` otherwise.\n * @example\n * ```ts\n * isArray([1, 2, 3]) // true\n * isArray('foo') // false\n * ```\n */\n <T>(\n value: Maybe<ReadonlyArray<ArrayElement<T>>>\n ): value is NonNullable<typeof value>;\n\n /**\n * The same as `Array.isArray` but with a better type guard.\n * @param value The value to check.\n * @returns `true` if the value is an array, `false` otherwise.\n * @example\n * ```ts\n * isArray([1, 2, 3]) // true\n * isArray('foo') // false\n * ```\n */\n <T>(value: Maybe<Many<T>>): value is NonNullable<readonly T[]>;\n /**\n * The same as `Array.isArray` but with a better type guard.\n * @param value The value to check.\n * @returns `true` if the value is an array, `false` otherwise.\n * @example\n * ```ts\n * isArray([1, 2, 3]) // true\n * isArray('foo') // false\n * ```\n */\n <T>(value: unknown): value is readonly T[];\n}\n\ntype ArrayElement<T> = T extends ReadonlyArray<infer U> ? U : never;\n","import { Many, Maybe } from '../../types';\nimport { isArray } from '../isArray';\n\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined(null) // null\n * ```\n */\nexport function castArrayIfDefined(value: null): null;\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @example\n * ```ts\n * castArrayIfDefined(undefined) // undefined\n * ```\n */\nexport function castArrayIfDefined(value: undefined): undefined;\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * ```\n */\nexport function castArrayIfDefined<T>(value: readonly T[]): readonly T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * ```\n */\nexport function castArrayIfDefined<T>(value: T[]): T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * castArrayIfDefined(42) // [42]\n * ```\n */\nexport function castArrayIfDefined<T>(value: NonNullable<T>): T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * castArrayIfDefined(42) // [42]\n * ```\n */\nexport function castArrayIfDefined<T>(\n value: Maybe<\n Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n >\n): Maybe<T[]>;\n/**\n * Implementation for all overloads.\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n */\nexport function castArrayIfDefined<T>(\n value: Maybe<\n Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n >\n) {\n if (value == null) {\n return value;\n }\n\n if (isArray(value)) {\n return value;\n }\n\n return [value];\n}\n","import { Many, Maybe } from '../../types';\nimport { castArrayIfDefined } from '../castArrayIfDefined';\n\n// NOTE: all JSDocs here are duplicated of one another since there's no way to inherit them at this time.\n// see https://github.com/microsoft/TypeScript/issues/407 for more info.\n\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: null): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: undefined): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: readonly T[]): readonly T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: T[]): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(\n value: Maybe<\n Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n >\n): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: NonNullable<T>): T[];\n/**\n * Implementation for all overloads.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(\n value: Maybe<\n Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n >\n) {\n return castArrayIfDefined(value ?? []);\n}\n","import { Maybe } from '../../types';\n\n/**\n * Splits an array into chunks of the given size.\n * @param array The array to split.\n * @param size The maximum size of each chunk.\n * @returns An array of arrays where each sub-array has at most `size` elements.\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * ```\n */\nexport function chunk<T>(array: Maybe<readonly T[]>, size: number): T[][] {\n if (array == null) {\n return [];\n }\n\n const chunks = [];\n for (let index = 0; index < array.length; index += size) {\n chunks.push(array.slice(index, index + size));\n }\n\n return chunks;\n}\n\n/**\n * Alias for {@link chunk}.\n */\nexport const chunkArray = chunk;\n","import { CastToString } from '../../types';\n\ninterface ClampOptions {\n /**\n * Whether the clamping should be inclusive of the range.\n * @default true\n */\n inclusive?: boolean | 'min' | 'max';\n}\n\n/**\n * Clamps a number to a specified range.\n * @param value The number to clamp.\n * @param range The range to clamp to, as a tuple of min and max values.\n * @param options Optional parameters.\n * @param options.inclusive Whether the clamping should be inclusive of the min and/or max value.\n * - If `true`, the clamping is inclusive of both min and max.\n * - If `false`, the clamping is exclusive of both min and max.\n * - If `'min'`, the clamping is inclusive of the min value but exclusive of the max value.\n * - If `'max'`, the clamping is exclusive of the min value but inclusive of the max value.\n * @returns The clamped number.\n * @example\n * ```typescript\n * clamp(3, [1, 5]); // 3\n * clamp(5, [1, 5]); // 5\n * clamp(5, [1, 5], { inclusive: false }); // 4\n * clamp(1, [1, 5], { inclusive: 'max' }); // 5\n * ```\n */\n// eslint-disable-next-line consistent-return -- we have an exhaustive check, so we never get to the end of the function\nexport function clamp(\n value: number,\n range: readonly [min: number, max: number],\n options?: ClampOptions\n): number {\n const [min, max] = range;\n if (min > max) {\n throw new RangeError(`Invalid range: [${min},${max}]`);\n }\n\n const { inclusive = true } = options ?? {};\n\n return {\n true: () => Math.max(min, Math.min(max, value)),\n false: () => Math.max(min + 1, Math.min(max - 1, value)),\n min: () => Math.max(min, Math.min(max - 1, value)),\n max: () => Math.max(min + 1, Math.min(max, value)),\n }[inclusive as CastToString<typeof inclusive>]();\n}\n","/**\n * Changes the casing of a string to constant case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to constant case.\n * @example\n * ```ts\n * constantCase('fooBar') // 'FOO_BAR'\n * constantCase('foo bar') // 'FOO_BAR'\n * constantCase('foo-bar') // 'FOO_BAR'\n * constantCase('fooBar42') // 'FOO_BAR42'\n * ```\n */\nexport function constantCase<S extends string>(string: S): ConstantCase<S> {\n if (!/[a-z]+/i.test(string)) {\n return '' as ConstantCase<S>;\n }\n\n return string\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s-]+/g, '_')\n .toUpperCase() as ConstantCase<S>;\n}\n\n/**\n * Changes the casing of a string to constant case.\n * @see {@link constantCase}.\n */\nexport type ConstantCase<S extends string> = Uppercase<\n S extends `${infer S1}${infer S2}`\n ? `${S1 extends '-'\n ? '_'\n : S1 extends ' '\n ? '_'\n : S1 extends '_'\n ? '_'\n : S1 extends Capitalize<S1>\n ? `_${Lowercase<S1>}`\n : S1}${ConstantCase<S2>}`\n : S\n>;\n","import { Maybe } from '../../../types';\n\nexport function filter<T>(source: Maybe<Iterable<T>>): T[] | undefined;\nexport function filter<T>(\n source: Maybe<Iterable<T>>,\n predicate?: (value: T, index: number) => boolean\n): T[] | undefined;\nexport function filter<T, S>(\n source: Maybe<Iterable<T>>,\n predicate?: (value: S, index: number) => value is S\n): S[] | undefined;\nexport function filter<T>(\n source: Maybe<Iterable<T>>,\n predicate?: (value: T, index: number) => boolean\n): T[] | undefined {\n if (source == null) {\n return undefined;\n }\n\n const relevantItems =\n predicate == null\n ? [...source]\n : // eslint-disable-next-line unicorn/no-array-callback-reference -- this is fine, we want to use the same predicate\n [...source].filter(predicate);\n\n return relevantItems;\n}\n","import { Maybe } from '../../types';\nimport { filter } from '../_internal/filterIterable';\n\n/**\n * Returns the number of elements in an iterable.\n * @param source The iterable to count.\n * @returns The number of elements.\n * @example\n * ```ts\n * count([1, 2, 3]); // 3\n * count([]); // 0\n * count(null); // 0\n * ```\n */\nexport function count<T>(source: Maybe<Iterable<T>>): number;\n/**\n * Returns the number of elements in an iterable that satisfy a predicate.\n * @param source The iterable to count.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The number of matching elements.\n * @example\n * ```ts\n * count([1, 2, 3], x => x % 2 === 0); // 1\n * count([1, 2, 3], x => x >= 2); // 2\n * count([], x => x >= 1); // 0\n * count(null, x => x >= 1); // 0\n * ```\n */\nexport function count<T>(\n source: Maybe<Iterable<T>>,\n predicate?: (value: T, index: number) => boolean\n): number;\n/**\n * Implementation for all overloads.\n * @param source The iterable to count.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The number of matching elements.\n */\nexport function count<T>(\n source: Maybe<Iterable<T>>,\n predicate?: (value: T, index: number) => boolean\n): number {\n const relevantItems = filter(source, predicate);\n return relevantItems?.length ?? 0;\n}\n","/**\n * Creates a type guard that checks if the given type is assignable to the given type.\n * @param values The values to check against.\n * @template {TInput} The type to check against, `unknown` by default. Pass in if you want to have a narrowed type for the type predicate (e.g. `string`).\n * @returns A type guard that checks if the given type is assignable to the given type.\n * @example\n * ```ts\n * const isValidValue = createTypeGuard(['foo', 'bar']);\n *\n * const value: unknown = '...';\n * if (isValidValue(value)) {\n * // ✅ value is of type `'foo' | 'bar'`\n * }\n * ```\n */\nexport function createTypeGuard<\n const TKnownValue,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- without this we can't have a default type of `unknown`\n TInput extends TKnownValue | unknown = unknown,\n>(values: Iterable<TKnownValue>): (v: TInput) => v is TInput & TKnownValue {\n const setValues = new Set<unknown>(values);\n return function predicate(v: unknown): v is TInput & TKnownValue {\n return setValues.has(v);\n };\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Creates a debounced function that delays invoking `func` until after `delay` milliseconds have elapsed since the last time the debounced function was invoked.\n * @param func The function to debounce.\n * @param delay The number of milliseconds to delay.\n * @param options Optional configuration options.\n * @param options.leading Whether to call the function on the leading edge of the timeout.\n * @returns A debounced function that can be called multiple times, but only invokes `func` once per `delay` milliseconds.\n */\nexport function debounce<TFunction extends AnyFunction<void | undefined>>(\n func: TFunction,\n delay: number,\n options: {\n /**\n * Whether to call the function on the leading edge of the timeout.\n * @default false\n */\n leading?: boolean;\n } = {}\n): DebouncedFunction<TFunction> {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n let isCalled = false;\n let latestArguments: Parameters<TFunction>;\n\n function debouncedFunction(...args: Parameters<TFunction>): void {\n latestArguments = args;\n\n if (options.leading && !isCalled) {\n func(...args);\n isCalled = true;\n }\n\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n if (!options.leading) {\n func(...args);\n }\n isCalled = false;\n }, delay);\n }\n\n debouncedFunction.flush = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n func(...latestArguments);\n };\n\n debouncedFunction.clear = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n };\n\n return debouncedFunction;\n}\n\ninterface DebouncedFunction<TFunction extends AnyFunction<void | undefined>> {\n (...args: Parameters<TFunction>): void;\n clear(): void;\n flush(): void;\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Returns a new function that negates the result of the input function.\n * @param func The input function to negate.\n * @returns A new function that negates the result of the input function.\n * @example\n * ```ts\n * const isEven = (num: number) => num % 2 === 0;\n * const isOdd = negate(isEven);\n * isOdd(1); // true\n * isOdd(2); // false\n * ```\n */\nexport function negate<Func extends AnyFunction<boolean>>(\n func: Func\n): (...args: Parameters<Func>) => boolean {\n return (...args: Parameters<Func>) => {\n const result = func(...args);\n return !result;\n };\n}\n","import type { IsLiteral } from 'type-fest';\n\nimport { createTypeGuard } from '../createTypeGuard';\nimport { negate } from '../negate';\n\n/**\n * Gets the difference between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the difference between the two arrays - items that are in the first array but not in the second.\n * @example\n * ```ts\n * difference([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function difference<const T, const S extends T>(\n array1: readonly T[],\n array2: readonly S[],\n comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T>;\n/**\n * Gets the difference between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the difference between the two arrays - items that are in the first array but not in the second.\n * @example\n * ```ts\n * difference([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function difference<T, S extends T>(\n array1: readonly T[],\n array2: readonly S[],\n comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T>;\n// eslint-disable-next-line jsdoc/require-jsdoc -- implementation of the overload signatures\nexport function difference<T, S extends T>(\n array1: readonly T[],\n array2: readonly S[],\n comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T> {\n // no comparator provided - we can do a quicker check using `Object.is` via a Set.\n if (!comparator) {\n const isArray2Item = createTypeGuard(array2);\n return array1.filter(negate(isArray2Item)) as Array<Exclude<T, S>>;\n }\n\n return array1.filter(\n (a1): a1 is Exclude<T, S> => !array2.some((a2) => comparator(a1, a2))\n );\n}\n\ntype Comparator<T, S extends T> =\n | ((a: T, b: S) => a is Exclude<T, S>)\n | ((a: T, b: S) => boolean);\n","/**\n * Ensures that the string starts with the given prefix.\n * @param string The string to ensure the prefix of.\n * @param prefix The prefix to ensure.\n * @returns The string with the given prefix.\n * @example\n * ```ts\n * ensurePrefix('foo', 'bar'); // 'barfoo'\n * ensurePrefix('foobar', 'foo'); // 'foobar'\n * ```\n */\nexport function ensurePrefix<S extends string, Prefix extends string>(\n string: S,\n prefix: Prefix\n): EnsurePrefix<S, Prefix> {\n if (string.startsWith(prefix)) {\n return string as EnsurePrefix<S, Prefix>;\n }\n\n return `${prefix}${string}` as EnsurePrefix<S, Prefix>;\n}\n\ntype EnsurePrefix<\n S extends string,\n Prefix extends string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n> = S extends `${Prefix}${infer _Suffix}` ? S : `${Prefix}${S}`;\n","/**\n * Ensures that the string ends with the given suffix.\n * @param string The string to ensure the suffix of.\n * @param suffix The suffix to ensure.\n * @returns The string with the given suffix.\n * @example\n * ```ts\n * ensureSuffix('foo', 'bar'); // 'foobar'\n * ensureSuffix('foobar', 'bar'); // 'foobar'\n * ```\n */\nexport function ensureSuffix<S extends string, Suffix extends string>(\n string: S,\n suffix: Suffix\n): EnsureSuffix<S, Suffix> {\n if (string.endsWith(suffix)) {\n return string as EnsureSuffix<S, Suffix>;\n }\n\n return `${string}${suffix}` as EnsureSuffix<S, Suffix>;\n}\n\ntype EnsureSuffix<\n S extends string,\n Suffix extends string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n> = S extends `${infer _Prefix}${Suffix}` ? S : `${S}${Suffix}`;\n","import { KeysOfUnion, StringWithAutocomplete } from '../../types';\n\n/**\n * Returns whether the input value has the specified key.\n * @param value The value to check.\n * @param key The key to check for.\n * @returns Whether the input value has the specified key.\n * @example\n * ```ts\n * hasKey({ a: 1 }, 'a') // true\n * hasKey({ a: 1 }, 'b') // false\n * ```\n */\nexport function hasKey<\n T extends object,\n K extends StringWithAutocomplete<KeysOfUnion<T> & string> | PropertyKey,\n>(value: T, key: K): value is T & Record<K, unknown> {\n if (typeof value !== 'object' || value == null) {\n return false;\n }\n\n return key in value;\n}\n","import type { Get } from 'type-fest';\n\nimport { Many, ObjectPath } from '../../types';\nimport { hasKey } from '../hasKey';\nimport { isArray } from '../isArray';\n\n/**\n * Gets the value at path of object.\n * Allows accessing properties in unions of objects and getting undefined if the property is not present.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n * @example\n * ```ts\n * get({ a: 1, b: 2, c: 3 }, 'b') // 2\n * get({\n * name: \"John Doe\",\n * address: {\n * street: \"123 Main St\",\n * city: \"Anytown\",\n * }\n * }, 'address.city') // \"Anytown\"\n * ```\n */\nexport function get<T, Path extends ObjectPath<T>>(\n object: T,\n path: Path\n): Get<T, Path>;\n/**\n * Gets the value at path of object.\n * Allows accessing properties in unions of objects and getting undefined if the property is not present.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n * @example\n * ```ts\n * get({\n * name: \"John Doe\",\n * address: {\n * street: \"123 Main St\",\n * city: \"Anytown\",\n * }\n * }, ['address', 'city']) // \"Anytown\"\n * ```\n */\nexport function get<T, Path extends Many<string>>(\n object: T,\n path: Path\n): Get<T, Path>;\n/**\n * Implementation of all overloads.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n */\nexport function get<T, Path extends ObjectPath<T> | Many<string>>(\n object: T,\n path: Path\n): Get<T, Path> {\n const keys: readonly string[] = isArray(path) ? path : path.split('.');\n\n return keys.reduce<unknown>((value, key) => {\n if (hasKey(value as object, key)) {\n return (value as Record<typeof key, unknown>)[key];\n }\n\n // eslint-disable-next-line unicorn/no-useless-undefined -- default value, explicitly declare it\n return undefined;\n }, object as object) as Get<T, Path>;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Takes an array and returns an object with the keys of the array mapped to the items of the array.\n * @param array The