moderndash 0.0.8 → 0.0.10

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/chunk.ts","../src/array/differenceWith.ts","../src/lang/isEqual.ts","../src/array/difference.ts","../src/helpers/typeofChecks.ts","../src/helpers/shortHands.ts","../src/lang/isEqualWith.ts","../src/array/differenceBy.ts","../src/array/dropRightWhile.ts","../src/array/dropWhile.ts","../src/array/intersectionWith.ts","../src/array/intersection.ts","../src/array/intersectionBy.ts","../src/array/sample.ts","../src/array/sampleSize.ts","../src/array/shuffle.ts","../src/array/takeRightWhile.ts","../src/array/takeWhile.ts","../src/array/union.ts","../src/array/unionWith.ts","../src/array/unionBy.ts","../src/array/uniqWith.ts","../src/array/uniq.ts","../src/array/uniqBy.ts","../src/array/unzipWith.ts","../src/array/unzip.ts","../src/array/zipWith.ts","../src/array/zip.ts","../src/helpers/collections.ts","../src/collection/countBy.ts","../src/collection/groupBy.ts","../src/collection/sortBy.ts","../src/function/after.ts","../src/function/before.ts","../src/function/debounce.ts","../src/function/memoize.ts","../src/function/once.ts","../src/function/throttle.ts","../src/lang/isEmpty.ts","../src/lang/isPlainObject.ts","../src/object/pick.ts","../src/string/deburr.ts","../src/helpers/stringModifiers.ts","../src/string/camelCase.ts","../src/string/capitalize.ts","../src/string/escape.ts","../src/string/escapeRegExp.ts","../src/string/kebabCase.ts","../src/string/pascalCase.ts","../src/string/snakeCase.ts","../src/string/startCase.ts","../src/string/stripSpecialChars.ts","../src/string/unescape.ts"],"sourcesContent":["/**\n * Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements.\n *\n * @category Array\n * @returns Returns the new array of chunks.\n * @param chunkSize - The array to process.\n * @param array - The length of each chunk\n * @example\n * chunk(2, ['a', 'b', 'c', 'd'])\n * // => [['a', 'b'], ['c', 'd']]\n *\n * chunk(3, ['a', 'b', 'c', 'd'])\n * // => [['a', 'b', 'c'], ['d']]\n */\n\nexport function chunk<TInput>(chunkSize: number, array: TInput[]): TInput[][] {\n const sizeInteger = Math.trunc(chunkSize);\n if (array.length === 0 || sizeInteger < 1) {\n return [];\n }\n\n const chunkedArray = [];\n let i = 0;\n\n while (i < array.length) {\n chunkedArray.push(array.slice(i, i + sizeInteger));\n i += sizeInteger;\n }\n\n return chunkedArray;\n}\n","import type { MinimumTwoArrays } from '../types';\n\n/**\n * This method is like `difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `pullAllWith`, this method returns a new array.\n *\n * @category Array\n * @param comparator - The comparator invoked per element.\n * @param arrays - First array to inspect. Others are excluded.\n * @returns Returns the new array of filtered values.\n * @example\n * differenceWith(isEqual, [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }], [{ 'x': 1, 'y': 2 }])\n * // => [{ 'x': 2, 'y': 1 }]\n */\n\nexport function differenceWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[] {\n const difference: T[] = [];\n const [firstArray, ...restArrays] = arrays;\n\n firstArray.forEach(element => {\n if (!restArrays.some(array => array.some(item => comparator(item, element)))) {\n difference.push(element);\n }\n });\n\n return difference;\n}\n","import type { RecordKey } from '../types';\n\nexport function isEqual(value1: unknown, value2: unknown): boolean {\n if (value1 === value2) return true;\n\n if (Array.isArray(value1) && Array.isArray(value2)) {\n return isSameArray(value1, value2);\n }\n\n if (value1 instanceof RegExp && value2 instanceof RegExp) {\n return value1.toString() === value2.toString();\n }\n\n if (isObject(value1) && isObject(value2)) {\n return isSameObject(value1, value2);\n }\n\n return false;\n}\n\ntype KeyValueObject = Record<RecordKey, unknown>;\nfunction isObject(value: unknown): value is KeyValueObject {\n return typeof value === 'object'\n && value !== null\n && !Array.isArray(value)\n && Object.prototype.toString.call(value) === '[object Object]';\n}\n\nfunction isSameObject(value1: KeyValueObject, value2: KeyValueObject) {\n // check if the objects have the same keys\n const keys1 = Object.keys(value1);\n const keys2 = Object.keys(value2);\n if (!isEqual(keys1, keys2)) return false;\n\n // check if the values of each key in the objects are equal\n for (const key of keys1) {\n if (!isEqual(value1[key], value2[key])) return false;\n }\n\n // the objects are deeply equal\n return true;\n}\n\nfunction isSameArray(value1: unknown[], value2: unknown[]) {\n // check if the arrays have the same length\n if (value1.length !== value2.length) return false;\n\n // check if the values of each element in the arrays are equal\n for (const [i, element] of value1.entries()) {\n if (!isEqual(element, value2[i])) return false;\n }\n\n return true;\n}\n","import type { MinimumTwoArrays } from '../types';\n\nimport { differenceWith } from '@array/differenceWith';\nimport { isEqual } from '@lang/isEqual';\n\n/**\n * Creates an array of `array` values not included in the other given arrays. The order and references of result values are determined by the first array.\n *\n * **Note:** Unlike `pullAll`, this method returns a new array.\n *\n * @category Array\n * @param arrays - First array is inspected, others are excluded.\n * @returns Returns the new array of filtered values.\n * @example\n * difference([2, 1], [2, 3])\n * // =\\> [1]\n */\n\nexport function difference<T>(...arrays: MinimumTwoArrays<T>): T[] {\n return differenceWith(isEqual, ...arrays);\n}\n","export function isObjectKey(key: unknown): key is keyof object {\n return typeof key === 'string' || typeof key === 'number' || typeof key === 'symbol';\n}\n","import type { IterateeFunction, PropertyShorthand } from '../types';\n\nimport { isObjectKey } from '@helpers/typeofChecks';\n\nexport function getPropertyShorthand<T, K extends keyof T>(key: K): (object: T) => T[K] {\n return object => object[key];\n}\n\nexport function getIterateFunction<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>) {\n if (typeof iteratee === 'function') {\n return iteratee;\n } else if (isObjectKey(iteratee)) {\n return getPropertyShorthand(iteratee);\n } else {\n throw new TypeError('Expected iteratee to be a function or a property name');\n }\n}\n","import { isEqual } from '@lang/isEqual';\n\nexport function isEqualWith<T>(customizer: (value: T) => unknown, a: T, b: T): boolean {\n return isEqual(customizer(a), customizer(b));\n}\n","import type { IterateeFunction, MinimumTwoArrays, PropertyShorthand } from '../types';\n\nimport { differenceWith } from '@array/differenceWith';\nimport { getIterateFunction } from '@helpers/shortHands';\nimport { isEqualWith } from '@lang/isEqualWith';\n\n/**\n * This method is like `difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `pullAllBy`, this method returns a new array.\n *\n * @category Array\n * @param iteratee - The iteratee invoked per element. Or property shorthand.\n * @param arrays - First array to inspect. Others are excluded.\n\n * @returns Returns the new array of filtered values.\n * @example\n * differenceBy(Math.floor, [2.1, 1.2], [2.3, 3.4])\n * // => [1.2]\n * differenceBy('x', [{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }])\n * // => [{ 'x': 2 }]\n */\n\nexport function differenceBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[] {\n const iterateeFunction = getIterateFunction(iteratee);\n return differenceWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);\n}\n","/**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @category Array\n * @param predicate - The function invoked per iteration.\n * @param array - The array to query.\n * @returns Returns the slice of `array`.\n * @example\n * const users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': true },\n * { 'user': 'pebbles', 'active': true }\n * ]\n *\n * dropRightWhile(({ active }) => active, users)\n * // => objects for ['barney']\n */\n\n\nexport function dropRightWhile<T>(predicate: (value: T) => boolean, array: T[]) {\n let i = array.length;\n while (i > 0 && predicate(array[i - 1])) {\n i--;\n }\n return array.slice(0, i);\n}\n","/**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @category Array\n * @param predicate - The function invoked per iteration.\n * @param array - The array to query.\n * @returns Returns the slice of `array`.\n * @example\n * const users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': true },\n * { 'user': 'pebbles', 'active': false }\n * ]\n *\n * dropWhile(({ active }) => active, users)\n * // => objects for ['pebbles']\n */\n\nexport function dropWhile<T>(predicate: (value: T) => boolean, array: T[]): T[] {\n const index = array.findIndex(x => !predicate(x));\n return array.slice(index === -1 ? array.length : index);\n}\n","import type { MinimumTwoArrays } from '../types';\n\n/**\n * This method is like `intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @category Array\n * @param comparator - The comparator invoked per element.\n * @param arrays - The arrays to inspect.\n * @returns Returns the new array of intersecting values.\n * @example\n * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]\n *\n * intersectionWith(isEqual, objects, others)\n * // => [{ 'x': 1, 'y': 2 }]\n */\n\nexport function intersectionWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[] {\n const intersection: T[] = [];\n\n const [firstArray, ...restArrays] = arrays;\n\n firstArray.forEach(element => {\n if (restArrays.every(array => array.some(item => comparator(item, element)))) {\n intersection.push(element);\n }\n });\n\n return intersection;\n}\n","import type { MinimumTwoArrays } from '../types';\n\nimport { intersectionWith } from '@array/intersectionWith';\nimport { isEqual } from '@lang/isEqual';\n\n/**\n * Creates an array of unique values that are included in all given arrays.\n * The order and references of result values are determined by the first array.\n *\n * @category Array\n * @param arrays - The arrays to inspect.\n * @returns Returns the new array of intersecting values.\n * @example\n * intersection([2, 1], [2, 3])\n * // => [2]\n */\n\nexport function intersection<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[] {\n return intersectionWith(isEqual, ...arrays);\n}\n","import type { IterateeFunction, MinimumTwoArrays, PropertyShorthand } from '../types';\n\nimport { intersectionWith } from '@array/intersectionWith';\nimport { getIterateFunction } from '@helpers/shortHands';\nimport { isEqualWith } from '@lang/isEqualWith';\n\n/**\n * This method is like `intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @category Array\n * @param iteratee - The iteratee invoked per element. Or property shorthand.\n * @param arrays - The arrays to inspect.\n * @returns Returns the new array of intersecting values.\n * @example\n * intersectionBy(Math.floor, [2.1, 1.2], [2.3, 3.4])\n * // => [2.1]\n */\n\nexport function intersectionBy<TInput>(iteratee: IterateeFunction<TInput> | PropertyShorthand<TInput>, ...arrays: MinimumTwoArrays<TInput>): TInput[] {\n const iterateeFunction = getIterateFunction(iteratee);\n return intersectionWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);\n}\n","/**\n * Gets a random element from `array`.\n *\n * @category Array\n * @param array - The array to sample.\n * @returns Returns the random element.\n * @example\n * sample([1, 2, 3, 4])\n * // => 2\n */\n\nexport function sample<T>(array: T[]): T | undefined {\n if (array.length === 0) {\n return undefined;\n }\n const randomIndex = Math.floor(Math.random() * array.length);\n return array[randomIndex];\n}\n","import { sample } from '@array/sample';\n\n/**\n * Gets `n` random elements at unique keys from `array` up to the\n * size of `array`.\n *\n * @category Array\n * @param size The number of elements to sample.\n * @param array The array to sample.\n * @returns Returns the random elements.\n * @example\n * sampleSize([1, 2, 3], 2)\n * // => [3, 1]\n *\n * sampleSize([1, 2, 3], 4)\n * // => [2, 3, 1]\n */\n\nexport function sampleSize<TInput>(size: number, array: TInput[]): TInput[] {\n const sampleArray: TInput[] = [];\n\n if (array.length === 0 || size <= 0) {\n return sampleArray;\n }\n\n for (let i = 0; i < size; i++) {\n sampleArray.push(sample(array) as TInput);\n }\n\n return sampleArray;\n}\n","/**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @since 0.1.0\n * @category Array\n * @param array - The array or object to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n * shuffle([1, 2, 3, 4])\n * // => [4, 1, 3, 2]\n */\n\nexport function shuffle<TInput>(array: TInput[]): TInput[] {\n const shuffledArray = [...array];\n let currentIndex = shuffledArray.length;\n let temporaryValue: TInput;\n let randomIndex: number;\n\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n\n // And swap it with the current element.\n temporaryValue = shuffledArray[currentIndex];\n shuffledArray[currentIndex] = shuffledArray[randomIndex];\n shuffledArray[randomIndex] = temporaryValue;\n }\n\n return shuffledArray;\n}\n","/**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @category Array\n * @param predicate - The function invoked per iteration.\n * @param array - The array to query.\n * @returns Returns the slice of `array`.\n * @example\n * const users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': true },\n * { 'user': 'pebbles', 'active': true }\n * ]\n *\n * takeRightWhile(({ active }) => active, users)\n * // => objects for ['fred', 'pebbles']\n */\n\nexport function takeRightWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[] {\n const result: T[] = [];\n\n for (let i = array.length - 1; i >= 0; i--) {\n if (predicate(array[i])) {\n result.unshift(array[i]);\n } else {\n break;\n }\n }\n\n return result;\n}\n","/**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @category Array\n * @param predicate The function invoked per iteration.\n * @param array The array to query.\n * @returns Returns the slice of `array`.\n * @example\n * const users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': true },\n * { 'user': 'pebbles', 'active': false }\n * ]\n *\n * takeWhile(({ active }) => active, users)\n * // => objects for ['barney', 'fred']\n */\n\nexport function takeWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[] {\n const result: T[] = [];\n\n for (const element of array) {\n if (predicate(element)) {\n result.push(element);\n } else {\n break;\n }\n }\n\n return result;\n}\n","import type { MinimumTwoArrays } from '../types';\n\n/**\n * Creates an array of unique values, in order, from all given arrays using for equality comparisons.\n *\n * @category Array\n * @param arrays - The arrays to inspect.\n * @returns Returns the new array of combined values.\n * @example\n * union([2, 3], [1, 2])\n * // => [2, 3, 1]\n */\n\nexport function union<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[] {\n return [...new Set(arrays.flat())];\n}\n","import type { MinimumTwoArrays } from '../types';\n\n/**\n * This method is like `union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @category Array\n * @param comparator - The comparator invoked per element.\n * @param arrays - The arrays to inspect.\n * @returns Returns the new array of combined values.\n * @example\n * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]\n *\n * unionWith(isEqual, objects, others)\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n\nexport function unionWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, ...arrays: MinimumTwoArrays<TInput>): TInput[] {\n return arrays.reduce((acc, current) => {\n for (const item of current) {\n if (acc.some(x => comparator(x, item))) {\n continue;\n }\n acc.push(item);\n }\n return acc;\n }, []);\n}\n","import type { IterateeFunction, MinimumTwoArrays, PropertyShorthand } from '../types';\n\nimport { unionWith } from '@array/unionWith';\nimport { getIterateFunction } from '@helpers/shortHands';\nimport { isEqualWith } from '@lang/isEqualWith';\n\n/**\n * This method is like `union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @category Array\n * @param arrays - The arrays to inspect.\n * @param iteratee - The iteratee invoked per element. Or property shorthand.\n * @returns Returns the new array of combined values.\n * @example\n * unionBy(Math.floor, [2.1], [1.2, 2.3])\n * // => [2.1, 1.2]\n */\n\nexport function unionBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[] {\n const iterateeFunction = getIterateFunction(iteratee);\n return unionWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);\n}\n","/**\n * This method is like `uniq` except that it accepts `comparator` which is invoked to compare elements of `array`.\n * The order of result values is determined by the order they occur in the array.\n *\n * @category Array\n * @param array - The array to inspect.\n * @param comparator - The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]\n *\n * uniqWith(isEqual, objects)\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n\nexport function uniqWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, array: TInput[]): TInput[] {\n return array.filter((value, index, self) => {\n return self.findIndex(otherValue => comparator(value, otherValue)) === index;\n });\n}\n","import { uniqWith } from '@array/uniqWith';\nimport { isEqual } from '@lang/isEqual';\n\n/**\n * Creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.\n * The order of result values is determined by the order they occur in the array.\n *\n * @category Array\n * @param array - The array to inspect.\n * @returns Returns the new duplicate free array.\n * @example\n * uniq([2, 1, 2])\n * // => [2, 1]\n */\n\nexport function uniq<TInput>(array: TInput[]): TInput[] {\n return uniqWith(isEqual, array);\n}\n","import type { IterateeFunction, PropertyShorthand } from '../types';\n\nimport { uniqWith } from '@array/uniqWith';\nimport { getIterateFunction } from '@helpers/shortHands';\n\n/**\n * This method is like `uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array.\n *\n * @category Array\n * @param array - The array to inspect.\n * @param iteratee - The iteratee invoked per element. Or property shorthand.\n * @returns Returns the new duplicate free array.\n * @example\n * uniqBy(Math.floor, [2.1, 1.2, 2.3])\n * // => [2.1, 1.2]\n */\n\nexport function uniqBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, array: T[]): T[] {\n const iterateeFunction = getIterateFunction(iteratee);\n\n return uniqWith((a, b) => iterateeFunction(a) === iterateeFunction(b), array);\n}\n","/**\n * This method is like `unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @category Array\n * @param iteratee - The function to combine regrouped values.\n * @param array - The array of grouped elements to process.\n * @returns Returns the new array of regrouped elements.\n * @example\n * const zipped = zip([1, 2], [10, 20], [100, 200])\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * unzipWith(add, zipped)\n * // => [3, 30, 300]\n */\n\nexport function unzipWith<TInput extends unknown[], TOutput>(iteratee: (...t: TInput) => TOutput, array: TInput[]): TOutput[] {\n const result: TOutput[] = [];\n\n for (const elements of array) {\n result.push(iteratee(...elements));\n }\n\n return result;\n}\n","import { unzipWith } from '@array/unzipWith';\n\n/**\n * This method is like `zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip configuration.\n *\n * @category Array\n * @param array - The array of grouped elements to process.\n * @returns Returns the new array of regrouped elements.\n * @example\n * const zipped = zip(['a', 'b'], [1, 2], [true, false])\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * unzip(zipped)\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n\nexport function unzip<TInput extends unknown[]>(array: TInput[]): TInput[] {\n return unzipWith((...t) => t, array);\n}\n","// Types from https://gist.github.com/briancavalier/c4af1538ae9b2e4ab97caf14306625ab\ntype UnZip<A extends readonly unknown[]> = {\n [K in keyof A]: readonly A[K][]\n};\n\n/**\n * This method is like `zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @category Array\n * @param combineFunc - The function to combine grouped values.\n * @param arrays - The arrays to process.\n * @returns Returns the new array of grouped elements.\n * @example\n * zipWith([1, 2], [10, 20], [100, 200], (a, b, c) => a + b + c)\n * // => [111, 222]\n */\n\nexport function zipWith<Args extends unknown[], TOutput>(combineFunc: (...args: Args) => TOutput, ...arrays: UnZip<Args>): TOutput[] {\n const len = Math.min(...arrays.map(a => a.length));\n const zipped: TOutput[] = [];\n for (let i = 0; i < len; i++) {\n // Typescript needs the Args hint, or it infers any[]\n zipped[i] = combineFunc(...arrays.map(a => a[i]) as Args);\n }\n return zipped;\n}\n","import { zipWith } from '@array/zipWith';\n\n/**\n * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,\n * the second of which contains the second elements of the given arrays, and so on.\n *\n * @category Array\n * @param arrays - The arrays to process.\n * @returns Returns the new array of grouped elements.\n * @example\n * zip(['a', 'b'], [1, 2], [true, false])\n * // => [['a', 1, true], ['b', 2, false]]\n */\n\nexport function zip<TInput>(...arrays: TInput[][]): TInput[][] {\n return zipWith((...t) => t, ...arrays);\n}\n","import type { ArrayOrRecord } from '../types';\n\nexport function getValuesFromCollection<T>(collection: ArrayOrRecord<T>): T[] {\n return Array.isArray(collection) ? collection : Object.values(collection);\n}\n","import type { ArrayOrRecord, RecordKey } from '../types';\n\nimport { getValuesFromCollection } from '@helpers/collections';\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`.\n *\n * @category Collection\n * @param iteratee - The iteratee to transform keys.\n * @param collection - The array or record to iterate over.\n * @returns Returns the composed aggregate object.\n * @example\n * const users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'betty', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ]\n *\n * countBy(users, value => value.active);\n * // => { 'true': 2, 'false': 1 }\n */\n\nexport function countBy<TInput, TKey extends RecordKey>(collection: ArrayOrRecord<TInput>, iteratee: (value: TInput) => TKey): Record<TKey, number> {\n const result = {} as Record<TKey, number>;\n const values = getValuesFromCollection(collection);\n for (const value of values) {\n const key = iteratee(value);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (result[key] === undefined) {\n result[key] = 1;\n } else {\n result[key] += 1;\n }\n }\n return result;\n}\n","import type { RecordKey, ArrayOrRecord } from '../types';\n\nimport { getValuesFromCollection } from '@helpers/collections';\n\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key.\n *\n * @category Collection\n * @param collection - The array or object to iterate over.\n * @param iteratee - The iteratee to transform keys.\n * @returns Returns the composed aggregate object.\n * @example\n * groupBy([6.1, 4.2, 6.3], Math.floor)\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n */\n\nexport function groupBy<T, U extends RecordKey>(collection: ArrayOrRecord<T>, iteratee: (value: T) => U): Record<U, T[]> {\n const result = {} as Record<U, T[]>;\n const values = getValuesFromCollection(collection);\n for (const value of values) {\n const key = iteratee(value);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n result[key] = result[key] ?? [];\n result[key].push(value);\n }\n return result;\n}\n","import type { NoUnion } from '../types';\n\nexport function sortBy<T, U>(iteratee: (item: T) => NoUnion<number | bigint | Date | string, U>, array: T[]): T[] {\n return array.sort((a, b) => {\n const aValue = iteratee(a);\n const bValue = iteratee(b);\n if (aValue < bValue) {\n return -1;\n }\n if (aValue > bValue) {\n return 1;\n }\n return 0;\n });\n}\n","/**\n * The opposite of `before`. This method creates a function that invokes `func` once it's called `n` or more times.\n *\n * @category Function\n * @param n The number of calls before `func` is invoked.\n * @param func The function to restrict.\n * @returns Returns the new restricted function.\n * @example\n * const caution = () => alert(\"Caution!\");\n *\n * // Display alert only after it has been called 5 times\n * after(5, caution)\n */\n\nexport function after<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc) {\n let count = 1;\n return (...args: Parameters<TFunc>): ReturnType<TFunc> | undefined => {\n if (count >= n) {\n return func(...args);\n }\n count += 1;\n };\n}\n","/**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @category Function\n * @param n - The number of calls at which `func` is no longer invoked.\n * @param func - The function to restrict.\n * @returns Returns the new restricted function.\n * @example\n * const caution = () => alert(\"Caution!\");\n *\n * // Only call caution two times\n * before(2, caution)\n */\n\nexport function before<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): TFunc {\n let count = 0;\n let result: ReturnType<TFunc>;\n return ((...args: Parameters<TFunc>): ReturnType<TFunc> => {\n if (count < n) {\n count += 1;\n result = func(...args);\n }\n return result;\n }) as TFunc;\n}\n","\n// TODO this is a port from lodash, it probably can be improved and shortened, also fix TS errors\nexport function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(\n fn: T, wait = 0, options: { leading?: boolean, maxWait?: number, trailing?: boolean } = {}\n): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T> {\n let lastArgs: Parameters<T> | undefined;\n let lastThis: ThisParameterType<T> | undefined;\n let result: ReturnType<T>;\n let timerId: ReturnType<typeof setTimeout> | undefined;\n let lastCallTime: number | undefined;\n let lastInvokeTime = 0;\n const maxing = options.maxWait ?? false;\n const leading = options.leading ?? false;\n const trailing = options.trailing ?? true;\n const maxWait = options.maxWait ?? 0;\n\n function invokeFunc(time: number) {\n const args: Parameters<T> | undefined = lastArgs;\n const thisArg: ThisParameterType<T> | undefined = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n // @ts-ignore\n result = fn.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time: number) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time: number) {\n // @ts-ignore\n const timeSinceLastCall = time - lastCallTime;\n const timeSinceLastInvoke = time - lastInvokeTime;\n const timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time: number) {\n if (lastCallTime === undefined)\n return true;\n\n const timeSinceLastCall = time - lastCallTime;\n const timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return timeSinceLastCall >= wait || timeSinceLastCall < 0 || (maxing && timeSinceLastInvoke >= maxWait);\n }\n\n function timerExpired() {\n const time = Date.now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time: number) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `fn` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(Date.now());\n }\n\n function debounced(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> {\n const time = Date.now();\n const isInvoking = shouldInvoke(time);\n\n lastArgs = args;\n // TODO Fix this assignment\n // eslint-disable-next-line @typescript-eslint/no-this-alias,unicorn/no-this-assignment\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n","const defaultResolver = (...args: unknown[]) => JSON.stringify(args);\ntype Cache = Map<string | symbol, unknown>;\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, all arguments\n * provided to the memoized function are used as the map cache key.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @category Function\n * @param func - The function to have its output memoized.\n * @param resolver - The function to resolve the cache key.\n * @returns Returns the new memoized function.\n * @example\n * const object = \\{ 'a': 1, 'b': 2 \\}\n *\n * const values = memoize(values)\n * values(object)\n * // => [1, 2]\n *\n * values(object)\n * // => [1, 2]\n *\n * object.a = 2\n * values(object)\n * // => [2, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b'])\n * values(object)\n * // => ['a', 'b']\n *\n * // Replace `memoize.Cache`.\n * memoize.Cache = WeakMap\n */\n\nexport function memoize<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(\n func: TFunc, resolver: ((...args: Parameters<TFunc>) => string | symbol) = defaultResolver\n): TFunc & { cache: Cache } {\n const cache: Cache = new Map();\n const memoizedFunc = (...args: Parameters<TFunc>): ReturnType<TFunc> => {\n const key = resolver(...args);\n if (cache.has(key)) {\n // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style\n return cache.get(key) as ReturnType<TFunc>;\n }\n const result = func(...args);\n cache.set(key, result);\n return result;\n };\n memoizedFunc.cache = cache;\n return memoizedFunc as TFunc & { cache: Cache };\n}\n","/**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @category Function\n * @param func - The function to restrict.\n * @returns Returns the new restricted function.\n * @example\n * const initialize = once(createApplication)\n * initialize()\n * initialize()\n * // => `createApplication` is invoked once\n */\nimport { before } from '@function/before';\n\nexport function once<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc): TFunc {\n return before(1, func);\n}\n","import { debounce } from '@function/debounce';\n\nexport function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(\n func: T, wait = 0, options: { leading?: boolean, trailing?: boolean } = {}\n): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T> {\n return debounce(func, wait, {\n leading: options.leading ?? true,\n maxWait: wait,\n trailing: options.trailing ?? true\n });\n}\n","export function isEmpty(value: unknown): boolean {\n if (value === null || value === undefined) {\n return true;\n }\n\n if (typeof value === 'string' || Array.isArray(value)) {\n return value.length === 0;\n }\n\n if (typeof value === 'number') {\n return false;\n }\n\n if (value instanceof Map || value instanceof Set) {\n return value.size === 0;\n }\n\n if (typeof value === 'object') {\n return Object.keys(value).length === 0;\n }\n\n return false;\n}\n","export function isPlainObject(value: unknown): value is object {\n return value !== null && typeof value === 'object' && value.constructor === Object;\n}\n","/**\n * Creates an object composed of the picked `object` properties.\n *\n * @category Object\n * @param object The source object.\n * @param keys The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * const object = { 'a': 1, 'b': '2', 'c': 3 }\n *\n * pick(object, ['a', 'c'])\n * // => { 'a': 1, 'c': 3 }\n */\n\nexport function pick<T, K extends keyof T>(object: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) {\n result[key] = object[key];\n }\n return result;\n}\n","export function deburr(str: string): string {\n // eslint-disable-next-line no-control-regex\n return str.replace(/[^\\u0000-\\u007E]/g, (chr: string) =>\n chr.normalize('NFD').replace(/[\\u0300-\\u036F]/g, ''));\n}\n","import { deburr } from '@string/deburr';\n\nexport function splitWords(str: string): string[] {\n str = deburr(str);\n\n // Split non-alphanumeric characters with spaces and deal with camel/PascalCase\n const regex = new RegExp(\n '[^\\\\dA-Za-z]' + // match any character that is not a letter or a digit\n '|' + // or\n '(?<=[a-z])' + // lookbehind for a lowercase letter\n '(?=[A-Z])' + // lookahead for an uppercase letter\n '|' + // or\n '(?<=[A-Z])' + // lookbehind for an uppercase letter\n '(?=[A-Z][a-z])' // lookahead for an uppercase letter followed by a lowercase letter\n );\n\n return str.split(regex).filter(Boolean);\n}\n","import { splitWords } from '@helpers/stringModifiers';\n\nexport function camelCase(str: string): string {\n const words = splitWords(str);\n\n // Capitalize the first letter of each word\n const camelCase = words.map((word, index) => {\n if (index === 0) {\n return word.toLowerCase();\n }\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n });\n\n return camelCase.join('');\n}\n","export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n","export function escape(str: string): string {\n const escapeChars: Record<string, string> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\\'': '&#39;',\n '\"': '&quot;'\n };\n return str.replace(/[\"&'<>]/g, char => escapeChars[char] || char);\n}\n","export function escapeRegExp(str: string): string {\n return str.replace(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&');\n}\n","import { splitWords } from '@helpers/stringModifiers';\n\nexport function kebabCase(str: string): string {\n const words = splitWords(str);\n let kebabCase = '';\n for (const word of words) {\n kebabCase += word.toLowerCase() + '-';\n }\n return kebabCase.slice(0, -1);\n}\n","import { splitWords } from '@helpers/stringModifiers';\n\nexport function pascalCase(str: string): string {\n const words = splitWords(str);\n let pascalCase = '';\n for (const word of words) {\n pascalCase += word.charAt(0).toUpperCase() + word.slice(1);\n }\n return pascalCase;\n}\n","import { splitWords } from '@helpers/stringModifiers';\n\nexport function snakeCase(str: string): string {\n const words = splitWords(str);\n let snakeCase = '';\n for (const word of words) {\n if (snakeCase.length > 0) {\n snakeCase += '_';\n }\n snakeCase += word.toLowerCase();\n }\n return snakeCase;\n}\n","import { splitWords } from '@helpers/stringModifiers';\n\nexport function startCase(str: string): string {\n const words = splitWords(str);\n let startCase = '';\n for (const word of words) {\n startCase += word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() + ' ';\n }\n return startCase.trimEnd();\n}\n","import { deburr } from '@string/deburr';\n\nexport function stripSpecialChars(str: string): string {\n str = deburr(str);\n return str.replace(/[^\\s\\w]/gi, '');\n}\n","export function unescapeHTML(html: string): string {\n const entityMap: Record<string, string> = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': '\\''\n };\n return html.replace(/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g, (entity: string) => entityMap[entity] || entity);\n}\n"],"mappings":";AAeO,SAAS,MAAc,WAAmB,OAA6B;AAC1E,QAAM,cAAc,KAAK,MAAM,SAAS;AACxC,MAAI,MAAM,WAAW,KAAK,cAAc,GAAG;AACvC,WAAO,CAAC;AAAA,EACZ;AAEA,QAAM,eAAe,CAAC;AACtB,MAAI,IAAI;AAER,SAAO,IAAI,MAAM,QAAQ;AACrB,iBAAa,KAAK,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC;AACjD,SAAK;AAAA,EACT;AAEA,SAAO;AACX;;;ACXO,SAAS,eAAkB,eAAwC,QAAkC;AACxG,QAAMA,cAAkB,CAAC;AACzB,QAAM,CAAC,eAAe,UAAU,IAAI;AAEpC,aAAW,QAAQ,aAAW;AAC1B,QAAI,CAAC,WAAW,KAAK,WAAS,MAAM,KAAK,UAAQ,WAAW,MAAM,OAAO,CAAC,CAAC,GAAG;AAC1E,MAAAA,YAAW,KAAK,OAAO;AAAA,IAC3B;AAAA,EACJ,CAAC;AAED,SAAOA;AACX;;;AC5BO,SAAS,QAAQ,QAAiB,QAA0B;AAC/D,MAAI,WAAW;AAAQ,WAAO;AAE9B,MAAI,MAAM,QAAQ,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG;AAChD,WAAO,YAAY,QAAQ,MAAM;AAAA,EACrC;AAEA,MAAI,kBAAkB,UAAU,kBAAkB,QAAQ;AACtD,W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UAAU,KAAqB;AAC3C,QAAM,QAAQ,WAAW,GAAG;AAC5B,MAAIC,aAAY;AAChB,aAAW,QAAQ,OAAO;AACtB,IAAAA,cAAa,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY,IAAI;AAAA,EAC9E;AACA,SAAOA,WAAU,QAAQ;AAC7B;;;ACPO,SAAS,kBAAkB,KAAqB;AACnD,QAAM,OAAO,GAAG;AAChB,SAAO,IAAI,QAAQ,aAAa,EAAE;AACtC;;;ACLO,SAAS,aAAa,MAAsB;AAC/C,QAAM,YAAoC;AAAA,IACtC,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACb;AACA,SAAO,KAAK,QAAQ,kDAAkD,CAAC,WAAmB,UAAU,WAAW,MAAM;AACzH;","names":["difference","intersection","camelCase","kebabCase","pascalCase","snakeCase","startCase"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "moderndash",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "description": "A lodash inspired utility framework for ESM/Typescript/ES2020",
6
6
  "scripts": {
7
7
  "build": "ctix create ----startAt src --overwrite --noBackup & tsup",
8
- "prepublishOnly": "npm run build && @powershell cp '../README.md' './README.md'",
9
- "postpublish": "@powershell rm './README.md'",
8
+ "prepublishOnly": "npm run build && @powershell cp '../README.md' './README.md' && @powershell cp '../LICENSE' './LICENSE'",
9
+ "postpublish": "@powershell rm './README.md' && @powershell rm './LICENSE'",
10
10
  "test": "vitest",
11
11
  "test-ui": "vitest --ui"
12
12
  },
@@ -30,7 +30,16 @@
30
30
  ">2% and not dead"
31
31
  ],
32
32
  "types": "./dist/index.d.ts",
33
- "main": "./dist/index.js",
33
+ "exports": {
34
+ ".": {
35
+ "import": "./dist/index.js",
36
+ "require": "./dist/index.cjs"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "src"
42
+ ],
34
43
  "homepage": "https://github.com/Maggi64/moderndash#readme",
35
44
  "devDependencies": {
36
45
  "@vitest/coverage-c8": "0.27.1",
@@ -1,4 +1,4 @@
1
- import type { Collection, RecordKey } from '../types';
1
+ import type { ArrayOrRecord, RecordKey } from '../types';
2
2
 
3
3
  import { getValuesFromCollection } from '@helpers/collections';
4
4
 
@@ -9,7 +9,7 @@ import { getValuesFromCollection } from '@helpers/collections';
9
9
  *
10
10
  * @category Collection
11
11
  * @param iteratee - The iteratee to transform keys.
12
- * @param collection - The array or object to iterate over.
12
+ * @param collection - The array or record to iterate over.
13
13
  * @returns Returns the composed aggregate object.
14
14
  * @example
15
15
  * const users = [
@@ -18,11 +18,11 @@ import { getValuesFromCollection } from '@helpers/collections';
18
18
  * { 'user': 'fred', 'active': false }
19
19
  * ]
20
20
  *
21
- * countBy(value => value.active, users);
21
+ * countBy(users, value => value.active);
22
22
  * // => { 'true': 2, 'false': 1 }
23
23
  */
24
24
 
25
- export function countBy<TInput, TKey extends RecordKey>(iteratee: (value: TInput) => TKey, collection: Collection<TInput>): Record<TKey, number> {
25
+ export function countBy<TInput, TKey extends RecordKey>(collection: ArrayOrRecord<TInput>, iteratee: (value: TInput) => TKey): Record<TKey, number> {
26
26
  const result = {} as Record<TKey, number>;
27
27
  const values = getValuesFromCollection(collection);
28
28
  for (const value of values) {
@@ -1,4 +1,4 @@
1
- import type { RecordKey, Collection } from '../types';
1
+ import type { RecordKey, ArrayOrRecord } from '../types';
2
2
 
3
3
  import { getValuesFromCollection } from '@helpers/collections';
4
4
 
@@ -11,16 +11,15 @@ import { getValuesFromCollection } from '@helpers/collections';
11
11
  * key.
12
12
  *
13
13
  * @category Collection
14
- * @param collection The array or object to iterate over.
15
- * @param iteratee The iteratee to transform keys.
14
+ * @param collection - The array or object to iterate over.
15
+ * @param iteratee - The iteratee to transform keys.
16
16
  * @returns Returns the composed aggregate object.
17
17
  * @example
18
- *
19
- * groupBy(Math.floor, [6.1, 4.2, 6.3])
18
+ * groupBy([6.1, 4.2, 6.3], Math.floor)
20
19
  * // => { '4': [4.2], '6': [6.1, 6.3] }
21
20
  */
22
21
 
23
- export function groupBy<T, U extends RecordKey>(iteratee: (value: T) => U, collection: Collection<T>): Record<U, T[]> {
22
+ export function groupBy<T, U extends RecordKey>(collection: ArrayOrRecord<T>, iteratee: (value: T) => U): Record<U, T[]> {
24
23
  const result = {} as Record<U, T[]>;
25
24
  const values = getValuesFromCollection(collection);
26
25
  for (const value of values) {
@@ -1,5 +1,5 @@
1
- import type { Collection } from '../types';
1
+ import type { ArrayOrRecord } from '../types';
2
2
 
3
- export function getValuesFromCollection<T>(collection: Collection<T>): T[] {
3
+ export function getValuesFromCollection<T>(collection: ArrayOrRecord<T>): T[] {
4
4
  return Array.isArray(collection) ? collection : Object.values(collection);
5
5
  }
package/src/types.ts CHANGED
@@ -5,5 +5,5 @@ export type PropertyShorthand<T> = keyof T;
5
5
 
6
6
  export type RecordKey = string | number | symbol;
7
7
 
8
- export type Collection<T> = T[] | Record<RecordKey, T>;
9
- export type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
8
+ export type ArrayOrRecord<T> = T[] | Record<RecordKey, T>;
9
+ export type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
package/tsconfig.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- "lib": ["ESNext", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- "types": [],
17
- // "jsx": "preserve", /* Specify what JSX code is generated. */
18
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
19
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
-
28
- /* Modules */
29
- "module": "esnext", /* Specify what module code is generated. */
30
- "rootDir": "./", /* Specify the root folder within your source files. */
31
- "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
32
- "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
37
- // "resolveJsonModule": true, /* Enable importing .json files. */
38
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
39
-
40
- /* JavaScript Support */
41
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
42
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
43
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
44
-
45
- /* Emit */
46
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
47
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
48
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
49
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
50
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
51
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
52
- // "removeComments": true, /* Disable emitting comments. */
53
- // "noEmit": true, /* Disable emitting files from a compilation. */
54
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
55
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
56
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
57
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
58
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
59
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
60
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
61
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
62
- // "newLine": "crlf", /* Set the newline character for emitting files. */
63
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
64
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
65
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
66
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
67
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
68
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
69
-
70
- /* Interop Constraints */
71
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
72
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
73
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
74
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
75
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
76
-
77
- /* Type Checking */
78
- "strict": true, /* Enable all strict type-checking options. */
79
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
80
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
81
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
82
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
83
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
84
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
85
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
86
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
87
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
88
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
89
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
90
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
91
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
92
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
93
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
94
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
95
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
96
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
97
-
98
- /* Completeness */
99
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
100
- "skipLibCheck": true,
101
- "paths": {
102
- "@array/*": ["src/array/*"],
103
- "@lang/*": ["src/lang/*"],
104
- "@function/*": ["src/function/*"],
105
- "@object/*": ["src/object/*"],
106
- "@string/*": ["src/string/*"],
107
- "@collection/*": ["src/collection/*"],
108
- "@helpers/*": ["src/helpers/*"]
109
- }
110
- },
111
- "include": ["./**/*.ts", "./**/*.js"]
112
- }