@vielzeug/arsenal 2.0.1 → 2.1.0

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.
Files changed (113) hide show
  1. package/dist/array/chunk.cjs.map +1 -1
  2. package/dist/array/chunk.js.map +1 -1
  3. package/dist/array/countBy.cjs.map +1 -1
  4. package/dist/array/countBy.d.ts.map +1 -1
  5. package/dist/array/countBy.js.map +1 -1
  6. package/dist/array/difference.cjs.map +1 -1
  7. package/dist/array/difference.d.ts.map +1 -1
  8. package/dist/array/difference.js.map +1 -1
  9. package/dist/array/groupBy.cjs.map +1 -1
  10. package/dist/array/groupBy.d.ts.map +1 -1
  11. package/dist/array/groupBy.js.map +1 -1
  12. package/dist/array/indexBy.cjs.map +1 -1
  13. package/dist/array/indexBy.d.ts.map +1 -1
  14. package/dist/array/indexBy.js.map +1 -1
  15. package/dist/array/intersection.cjs.map +1 -1
  16. package/dist/array/intersection.d.ts.map +1 -1
  17. package/dist/array/intersection.js.map +1 -1
  18. package/dist/array/union.cjs.map +1 -1
  19. package/dist/array/union.d.ts.map +1 -1
  20. package/dist/array/union.js.map +1 -1
  21. package/dist/array/uniq.cjs.map +1 -1
  22. package/dist/array/uniq.d.ts.map +1 -1
  23. package/dist/array/uniq.js.map +1 -1
  24. package/dist/arsenal.cjs +1 -1
  25. package/dist/arsenal.cjs.map +1 -1
  26. package/dist/arsenal.iife.js +1 -1
  27. package/dist/arsenal.iife.js.map +1 -1
  28. package/dist/arsenal.js +1 -1
  29. package/dist/arsenal.js.map +1 -1
  30. package/dist/async/abortable.cjs +2 -0
  31. package/dist/async/abortable.cjs.map +1 -0
  32. package/dist/async/abortable.d.ts +26 -0
  33. package/dist/async/abortable.d.ts.map +1 -0
  34. package/dist/async/abortable.js +12 -0
  35. package/dist/async/abortable.js.map +1 -0
  36. package/dist/async/backoff.cjs +1 -1
  37. package/dist/async/backoff.cjs.map +1 -1
  38. package/dist/async/backoff.js +1 -2
  39. package/dist/async/backoff.js.map +1 -1
  40. package/dist/async/index.cjs +1 -1
  41. package/dist/async/index.d.ts +1 -0
  42. package/dist/async/index.d.ts.map +1 -1
  43. package/dist/async/index.js +9 -8
  44. package/dist/async/taskPool.cjs.map +1 -1
  45. package/dist/async/taskPool.d.ts +4 -4
  46. package/dist/async/taskPool.d.ts.map +1 -1
  47. package/dist/async/taskPool.js.map +1 -1
  48. package/dist/cache/cache.cjs +1 -1
  49. package/dist/cache/cache.cjs.map +1 -1
  50. package/dist/cache/cache.d.ts.map +1 -1
  51. package/dist/cache/cache.js +1 -1
  52. package/dist/cache/cache.js.map +1 -1
  53. package/dist/cache/memo.cjs.map +1 -1
  54. package/dist/cache/memo.d.ts.map +1 -1
  55. package/dist/cache/memo.js.map +1 -1
  56. package/dist/errors.cjs +1 -1
  57. package/dist/errors.cjs.map +1 -1
  58. package/dist/errors.d.ts +0 -1
  59. package/dist/errors.d.ts.map +1 -1
  60. package/dist/errors.js +1 -4
  61. package/dist/errors.js.map +1 -1
  62. package/dist/function/debounce.cjs.map +1 -1
  63. package/dist/function/debounce.d.ts.map +1 -1
  64. package/dist/function/debounce.js.map +1 -1
  65. package/dist/function/pipe.cjs +1 -1
  66. package/dist/function/pipe.cjs.map +1 -1
  67. package/dist/function/pipe.js +1 -1
  68. package/dist/function/pipe.js.map +1 -1
  69. package/dist/function/runAll.cjs +1 -1
  70. package/dist/function/runAll.cjs.map +1 -1
  71. package/dist/function/runAll.js +1 -1
  72. package/dist/function/runAll.js.map +1 -1
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/object/defaults.cjs.map +1 -1
  76. package/dist/object/defaults.d.ts.map +1 -1
  77. package/dist/object/defaults.js.map +1 -1
  78. package/dist/object/diff.cjs.map +1 -1
  79. package/dist/object/diff.d.ts.map +1 -1
  80. package/dist/object/diff.js.map +1 -1
  81. package/dist/object/filterValues.cjs.map +1 -1
  82. package/dist/object/filterValues.d.ts.map +1 -1
  83. package/dist/object/filterValues.js.map +1 -1
  84. package/dist/object/getPath.cjs.map +1 -1
  85. package/dist/object/getPath.d.ts.map +1 -1
  86. package/dist/object/getPath.js.map +1 -1
  87. package/dist/object/mapKeys.cjs.map +1 -1
  88. package/dist/object/mapKeys.d.ts.map +1 -1
  89. package/dist/object/mapKeys.js.map +1 -1
  90. package/dist/object/mapValues.cjs.map +1 -1
  91. package/dist/object/mapValues.d.ts.map +1 -1
  92. package/dist/object/mapValues.js.map +1 -1
  93. package/dist/object/merge.cjs.map +1 -1
  94. package/dist/object/merge.d.ts.map +1 -1
  95. package/dist/object/merge.js.map +1 -1
  96. package/dist/object/omit.cjs.map +1 -1
  97. package/dist/object/omit.d.ts.map +1 -1
  98. package/dist/object/omit.js.map +1 -1
  99. package/dist/object/pick.cjs.map +1 -1
  100. package/dist/object/pick.d.ts.map +1 -1
  101. package/dist/object/pick.js.map +1 -1
  102. package/dist/random/draw.cjs.map +1 -1
  103. package/dist/random/draw.d.ts.map +1 -1
  104. package/dist/random/draw.js.map +1 -1
  105. package/dist/random/random.cjs.map +1 -1
  106. package/dist/random/random.d.ts.map +1 -1
  107. package/dist/random/random.js.map +1 -1
  108. package/dist/random/shuffle.cjs.map +1 -1
  109. package/dist/random/shuffle.d.ts.map +1 -1
  110. package/dist/random/shuffle.js.map +1 -1
  111. package/package.json +32 -27
  112. package/dist/_common/_abortable.d.ts +0 -5
  113. package/dist/_common/_abortable.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"merge.js","names":[],"sources":["../../src/object/merge.ts"],"sourcesContent":["import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\n\nexport type DeepMergeOptions = {\n /** How to handle arrays when both source and target contain one. Default: `'replace'`. */\n arrayStrategy?: 'concat' | 'replace';\n};\n\ntype DeepMerge<T, U> = T extends Obj\n ? U extends Obj\n ? {\n [K in keyof T | keyof U]: K extends keyof T\n ? K extends keyof U\n ? DeepMerge<T[K], U[K]>\n : T[K]\n : K extends keyof U\n ? U[K]\n : never;\n }\n : U\n : U;\n\ntype Merge<T extends Obj[]> = T extends [infer First, ...infer Rest]\n ? First extends Obj\n ? Rest extends Obj[]\n ? DeepMerge<First, Merge<Rest>>\n : First\n : Obj\n : Obj;\n\nfunction mergeObjects<T extends Obj, U extends Obj>(target: T, source: U, options: DeepMergeOptions): DeepMerge<T, U> {\n if (!isPlainObject(source)) return source as DeepMerge<T, U>;\n\n const result = { ...target } as DeepMerge<T, U>;\n\n for (const key of Object.keys(source)) {\n // Guard against prototype pollution: skip dangerous keys\n if (isUnsafeKey(key)) {\n continue;\n }\n\n const sourceValue = source[key];\n const targetValue = result[key];\n\n (result as Record<string, unknown>)[key] =\n Array.isArray(sourceValue) && Array.isArray(targetValue)\n ? options.arrayStrategy === 'concat'\n ? [...targetValue, ...sourceValue]\n : sourceValue\n : isPlainObject(sourceValue) && isPlainObject(targetValue)\n ? mergeObjects(targetValue as Obj, sourceValue as Obj, options)\n : sourceValue;\n }\n\n return result;\n}\n\n/**\n * Deeply merges two or more objects. Arrays in source objects **replace** the target array by default.\n * Pass `{ arrayStrategy: 'concat' }` as the last argument to concatenate arrays instead.\n *\n * @example\n * ```ts\n * deepMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 });\n * // { a: 1, b: { x: 1, y: 2 }, c: 3 }\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] });\n * // { tags: ['b'] } ← arrays replaced\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] }, { arrayStrategy: 'concat' });\n * // { tags: ['a', 'b'] }\n * ```\n */\nexport function deepMerge<T extends Obj[]>(items: readonly [...T], options: DeepMergeOptions = {}): Merge<T> {\n return items.reduce((acc: Obj, item) => mergeObjects(acc, item, options) as Obj, {} as Obj) as Merge<T>;\n}\n\n/**\n * Shallowly merges two or more objects. Later sources win for duplicate keys.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * shallowMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 } });\n * // { a: 1, b: { y: 2 } } ← nested object replaced, not merged\n *\n * shallowMerge(defaults, overrides, extras);\n * ```\n */\nexport function shallowMerge<T extends Obj[]>(...items: [...T]): Merge<T> {\n if (items.length === 0) return {} as Merge<T>;\n\n const result: Obj = {};\n\n for (const item of items) {\n for (const key of Object.keys(item)) {\n if (isUnsafeKey(key)) continue;\n\n result[key] = item[key];\n }\n }\n\n return result as Merge<T>;\n}\n"],"mappings":";;;AAgCA,SAAS,EAA2C,GAAW,GAAW,GAA4C;CACpH,IAAI,CAAC,EAAc,CAAM,GAAG,OAAO;CAEnC,IAAM,IAAS,EAAE,GAAG,EAAO;CAE3B,KAAK,IAAM,KAAO,OAAO,KAAK,CAAM,GAAG;EAErC,IAAI,EAAY,CAAG,GACjB;EAGF,IAAM,IAAc,EAAO,IACrB,IAAc,EAAO;EAE3B,EAAoC,KAClC,MAAM,QAAQ,CAAW,KAAK,MAAM,QAAQ,CAAW,IACnD,EAAQ,kBAAkB,WACxB,CAAC,GAAG,GAAa,GAAG,CAAW,IAC/B,IACF,EAAc,CAAW,KAAK,EAAc,CAAW,IACrD,EAAa,GAAoB,GAAoB,CAAO,IAC5D;CACV;CAEA,OAAO;AACT;AAkBA,SAAgB,EAA2B,GAAwB,IAA4B,CAAC,GAAa;CAC3G,OAAO,EAAM,QAAQ,GAAU,MAAS,EAAa,GAAK,GAAM,CAAO,GAAU,CAAC,CAAQ;AAC5F;AAcA,SAAgB,EAA8B,GAAG,GAAyB;CACxE,IAAI,EAAM,WAAW,GAAG,OAAO,CAAC;CAEhC,IAAM,IAAc,CAAC;CAErB,KAAK,IAAM,KAAQ,GACjB,KAAK,IAAM,KAAO,OAAO,KAAK,CAAI,GAC5B,EAAY,CAAG,MAEnB,EAAO,KAAO,EAAK;CAIvB,OAAO;AACT"}
1
+ {"version":3,"file":"merge.js","names":[],"sources":["../../src/object/merge.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\nexport type DeepMergeOptions = {\n /** How to handle arrays when both source and target contain one. Default: `'replace'`. */\n arrayStrategy?: 'concat' | 'replace';\n};\n\ntype DeepMerge<T, U> = T extends Obj\n ? U extends Obj\n ? {\n [K in keyof T | keyof U]: K extends keyof T\n ? K extends keyof U\n ? DeepMerge<T[K], U[K]>\n : T[K]\n : K extends keyof U\n ? U[K]\n : never;\n }\n : U\n : U;\n\ntype Merge<T extends Obj[]> = T extends [infer First, ...infer Rest]\n ? First extends Obj\n ? Rest extends Obj[]\n ? DeepMerge<First, Merge<Rest>>\n : First\n : Obj\n : Obj;\n\nfunction mergeObjects<T extends Obj, U extends Obj>(target: T, source: U, options: DeepMergeOptions): DeepMerge<T, U> {\n if (!isPlainObject(source)) return source as DeepMerge<T, U>;\n\n const result = { ...target } as DeepMerge<T, U>;\n\n for (const key of Object.keys(source)) {\n // Guard against prototype pollution: skip dangerous keys\n if (isUnsafeKey(key)) {\n continue;\n }\n\n const sourceValue = source[key];\n const targetValue = result[key];\n\n (result as Record<string, unknown>)[key] =\n Array.isArray(sourceValue) && Array.isArray(targetValue)\n ? options.arrayStrategy === 'concat'\n ? [...targetValue, ...sourceValue]\n : sourceValue\n : isPlainObject(sourceValue) && isPlainObject(targetValue)\n ? mergeObjects(targetValue as Obj, sourceValue as Obj, options)\n : sourceValue;\n }\n\n return result;\n}\n\n/**\n * Deeply merges two or more objects. Arrays in source objects **replace** the target array by default.\n * Pass `{ arrayStrategy: 'concat' }` as the last argument to concatenate arrays instead.\n *\n * @example\n * ```ts\n * deepMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 });\n * // { a: 1, b: { x: 1, y: 2 }, c: 3 }\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] });\n * // { tags: ['b'] } ← arrays replaced\n *\n * deepMerge({ tags: ['a'] }, { tags: ['b'] }, { arrayStrategy: 'concat' });\n * // { tags: ['a', 'b'] }\n * ```\n */\nexport function deepMerge<T extends Obj[]>(items: readonly [...T], options: DeepMergeOptions = {}): Merge<T> {\n return items.reduce((acc: Obj, item) => mergeObjects(acc, item, options) as Obj, {} as Obj) as Merge<T>;\n}\n\n/**\n * Shallowly merges two or more objects. Later sources win for duplicate keys.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * shallowMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 } });\n * // { a: 1, b: { y: 2 } } ← nested object replaced, not merged\n *\n * shallowMerge(defaults, overrides, extras);\n * ```\n */\nexport function shallowMerge<T extends Obj[]>(...items: [...T]): Merge<T> {\n if (items.length === 0) return {} as Merge<T>;\n\n const result: Obj = {};\n\n for (const item of items) {\n for (const key of Object.keys(item)) {\n if (isUnsafeKey(key)) continue;\n\n result[key] = item[key];\n }\n }\n\n return result as Merge<T>;\n}\n"],"mappings":";;;AA+BA,SAAS,EAA2C,GAAW,GAAW,GAA4C;CACpH,IAAI,CAAC,EAAc,CAAM,GAAG,OAAO;CAEnC,IAAM,IAAS,EAAE,GAAG,EAAO;CAE3B,KAAK,IAAM,KAAO,OAAO,KAAK,CAAM,GAAG;EAErC,IAAI,EAAY,CAAG,GACjB;EAGF,IAAM,IAAc,EAAO,IACrB,IAAc,EAAO;EAE3B,EAAoC,KAClC,MAAM,QAAQ,CAAW,KAAK,MAAM,QAAQ,CAAW,IACnD,EAAQ,kBAAkB,WACxB,CAAC,GAAG,GAAa,GAAG,CAAW,IAC/B,IACF,EAAc,CAAW,KAAK,EAAc,CAAW,IACrD,EAAa,GAAoB,GAAoB,CAAO,IAC5D;CACV;CAEA,OAAO;AACT;AAkBA,SAAgB,EAA2B,GAAwB,IAA4B,CAAC,GAAa;CAC3G,OAAO,EAAM,QAAQ,GAAU,MAAS,EAAa,GAAK,GAAM,CAAO,GAAU,CAAC,CAAQ;AAC5F;AAcA,SAAgB,EAA8B,GAAG,GAAyB;CACxE,IAAI,EAAM,WAAW,GAAG,OAAO,CAAC;CAEhC,IAAM,IAAc,CAAC;CAErB,KAAK,IAAM,KAAQ,GACjB,KAAK,IAAM,KAAO,OAAO,KAAK,CAAI,GAC5B,EAAY,CAAG,MAEnB,EAAO,KAAO,EAAK;CAIvB,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"omit.cjs","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAiBA,SAAgB,EAAuC,EAAQ,EAAuC,CACpG,IAAM,EAAY,IAAI,IAAiB,CAAqC,EACtE,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAA,YAAY,CAAkB,GAE7B,EAAU,IAAI,CAAG,IACpB,EAAW,GAAO,EAAI,IAI1B,OAAO,CACT"}
1
+ {"version":3,"file":"omit.cjs","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAgBA,SAAgB,EAAuC,EAAQ,EAAuC,CACpG,IAAM,EAAY,IAAI,IAAiB,CAAqC,EACtE,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAA,YAAY,CAAkB,GAE7B,EAAU,IAAI,CAAG,IACpB,EAAW,GAAO,EAAI,IAI1B,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAIpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAapG"}
1
+ {"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAapG"}
@@ -1 +1 @@
1
- {"version":3,"file":"omit.js","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":";;AAiBA,SAAgB,EAAuC,GAAQ,GAAuC;CACpG,IAAM,IAAY,IAAI,IAAiB,CAAqC,GACtE,IAAM,CAAC;CAEb,KAAK,IAAM,KAAO,OAAO,KAAK,CAAG,GAC3B,EAAY,CAAkB,KAE7B,EAAU,IAAI,CAAG,MACpB,EAAW,KAAO,EAAI;CAI1B,OAAO;AACT"}
1
+ {"version":3,"file":"omit.js","names":[],"sources":["../../src/object/omit.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":";;AAgBA,SAAgB,EAAuC,GAAQ,GAAuC;CACpG,IAAM,IAAY,IAAI,IAAiB,CAAqC,GACtE,IAAM,CAAC;CAEb,KAAK,IAAM,KAAO,OAAO,KAAK,CAAG,GAC3B,EAAY,CAAkB,KAE7B,EAAU,IAAI,CAAG,MACpB,EAAW,KAAO,EAAI;CAI1B,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"pick.cjs","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAkBA,SAAgB,EAAuC,EAAQ,EAAwC,CACrG,IAAM,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,EACZ,EAAA,YAAY,CAAkB,GAE9B,OAAO,OAAO,EAAK,CAAG,IACxB,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
1
+ {"version":3,"file":"pick.cjs","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAiBA,SAAgB,EAAuC,EAAQ,EAAwC,CACrG,IAAM,EAAM,CAAC,EAEb,IAAK,IAAM,KAAO,EACZ,EAAA,YAAY,CAAkB,GAE9B,OAAO,OAAO,EAAK,CAAG,IACxB,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../src/object/pick.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAYrG"}
1
+ {"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../src/object/pick.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAYrG"}
@@ -1 +1 @@
1
- {"version":3,"file":"pick.js","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":";;AAkBA,SAAgB,EAAuC,GAAQ,GAAwC;CACrG,IAAM,IAAM,CAAC;CAEb,KAAK,IAAM,KAAO,GACZ,EAAY,CAAkB,KAE9B,OAAO,OAAO,GAAK,CAAG,MACxB,EAAI,KAAO,EAAI;CAInB,OAAO;AACT"}
1
+ {"version":3,"file":"pick.js","names":[],"sources":["../../src/object/pick.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":";;AAiBA,SAAgB,EAAuC,GAAQ,GAAwC;CACrG,IAAM,IAAM,CAAC;CAEb,KAAK,IAAM,KAAO,GACZ,EAAY,CAAkB,KAE9B,OAAO,OAAO,GAAK,CAAG,MACxB,EAAI,KAAO,EAAI;CAInB,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"draw.cjs","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\nimport { random } from './random';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"0DAeA,SAAgB,EAAQ,EAAY,EAAsC,CACpE,KAAM,SAAW,EAErB,OAAO,EAAM,EAAA,OAAO,EAAG,EAAM,OAAS,EAAG,CAAM,EACjD,CAaA,SAAgB,EAAY,EAAY,EAAW,EAA4B,CAC7E,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,IAAI,EAAM,OAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,EAE/D,GAAI,IAAU,EAAG,MAAO,CAAC,EAEzB,GAAI,IAAU,EAAM,OAAQ,MAAO,CAAC,GAAG,CAAK,EAE5C,IAAM,EAAO,CAAC,GAAG,CAAK,EAEtB,IAAK,IAAI,EAAQ,EAAK,OAAS,EAAG,EAAQ,EAAG,IAAS,CACpD,IAAM,EAAgB,EAAA,YAAY,EAAQ,EAAG,CAAM,EAC7C,EAAO,EAAK,GAElB,EAAK,GAAS,EAAK,GACnB,EAAK,GAAiB,CACxB,CAEA,OAAO,EAAK,MAAM,EAAG,CAAK,CAC5B"}
1
+ {"version":3,"file":"draw.cjs","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":"0DAcA,SAAgB,EAAQ,EAAY,EAAsC,CACpE,KAAM,SAAW,EAErB,OAAO,EAAM,EAAA,OAAO,EAAG,EAAM,OAAS,EAAG,CAAM,EACjD,CAaA,SAAgB,EAAY,EAAY,EAAW,EAA4B,CAC7E,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,IAAI,EAAM,OAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,EAE/D,GAAI,IAAU,EAAG,MAAO,CAAC,EAEzB,GAAI,IAAU,EAAM,OAAQ,MAAO,CAAC,GAAG,CAAK,EAE5C,IAAM,EAAO,CAAC,GAAG,CAAK,EAEtB,IAAK,IAAI,EAAQ,EAAK,OAAS,EAAG,EAAQ,EAAG,IAAS,CACpD,IAAM,EAAgB,EAAA,YAAY,EAAQ,EAAG,CAAM,EAC7C,EAAO,EAAK,GAElB,EAAK,GAAS,EAAK,GACnB,EAAK,GAAiB,CACxB,CAEA,OAAO,EAAK,MAAM,EAAG,CAAK,CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../src/random/draw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,GAAG,SAAS,CAIxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,EAAE,CAkB7E"}
1
+ {"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../src/random/draw.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,GAAG,SAAS,CAIxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,EAAE,CAkB7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"draw.js","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\nimport { random } from './random';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":";;;AAeA,SAAgB,EAAQ,GAAY,GAAsC;CACpE,MAAM,WAAW,GAErB,OAAO,EAAM,EAAO,GAAG,EAAM,SAAS,GAAG,CAAM;AACjD;AAaA,SAAgB,EAAY,GAAY,GAAW,GAA4B;CAC7E,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,EAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;CAE/D,IAAI,MAAU,GAAG,OAAO,CAAC;CAEzB,IAAI,MAAU,EAAM,QAAQ,OAAO,CAAC,GAAG,CAAK;CAE5C,IAAM,IAAO,CAAC,GAAG,CAAK;CAEtB,KAAK,IAAI,IAAQ,EAAK,SAAS,GAAG,IAAQ,GAAG,KAAS;EACpD,IAAM,IAAgB,EAAY,IAAQ,GAAG,CAAM,GAC7C,IAAO,EAAK;EAGlB,AADA,EAAK,KAAS,EAAK,IACnB,EAAK,KAAiB;CACxB;CAEA,OAAO,EAAK,MAAM,GAAG,CAAK;AAC5B"}
1
+ {"version":3,"file":"draw.js","names":[],"sources":["../../src/random/draw.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport { random } from './random';\nimport type { RandomSource } from './source';\n\n/**\n * Picks a single random item from an array.\n * Returns `undefined` if the array is empty.\n *\n * @example\n * ```ts\n * draw([1, 2, 3]); // e.g. 2\n * draw([]); // undefined\n * ```\n */\nexport function draw<T>(array: T[], source?: RandomSource): T | undefined {\n if (array.length === 0) return undefined;\n\n return array[random(0, array.length - 1, source)];\n}\n\n/**\n * Picks up to `n` unique random items from an array using a cryptographically\n * random shuffle (Fisher-Yates via `crypto.getRandomValues`).\n * Returns a new array; does not mutate the input.\n *\n * @example\n * ```ts\n * drawMany([1, 2, 3, 4, 5], 3); // e.g. [4, 1, 3]\n * drawMany([1, 2], 10); // [1, 2] (clamped to array length)\n * ```\n */\nexport function drawMany<T>(array: T[], n: number, source?: RandomSource): T[] {\n const count = Math.max(0, Math.min(array.length, Math.floor(n)));\n\n if (count === 0) return [];\n\n if (count === array.length) return [...array];\n\n const copy = [...array];\n\n for (let index = copy.length - 1; index > 0; index--) {\n const selectedIndex = randomIndex(index + 1, source);\n const temp = copy[index];\n\n copy[index] = copy[selectedIndex]!;\n copy[selectedIndex] = temp!;\n }\n\n return copy.slice(0, count);\n}\n"],"mappings":";;;AAcA,SAAgB,EAAQ,GAAY,GAAsC;CACpE,MAAM,WAAW,GAErB,OAAO,EAAM,EAAO,GAAG,EAAM,SAAS,GAAG,CAAM;AACjD;AAaA,SAAgB,EAAY,GAAY,GAAW,GAA4B;CAC7E,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,EAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;CAE/D,IAAI,MAAU,GAAG,OAAO,CAAC;CAEzB,IAAI,MAAU,EAAM,QAAQ,OAAO,CAAC,GAAG,CAAK;CAE5C,IAAM,IAAO,CAAC,GAAG,CAAK;CAEtB,KAAK,IAAI,IAAQ,EAAK,SAAS,GAAG,IAAQ,GAAG,KAAS;EACpD,IAAM,IAAgB,EAAY,IAAQ,GAAG,CAAM,GAC7C,IAAO,EAAK;EAGlB,AADA,EAAK,KAAS,EAAK,IACnB,EAAK,KAAiB;CACxB;CAEA,OAAO,EAAK,MAAM,GAAG,CAAK;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"random.cjs","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"gCAgBA,SAAgB,EAAO,EAAa,EAAa,EAA+B,CAC9E,GAAI,EAAM,EAAK,MAAU,WAAW,8DAA8D,EAElG,OAAO,EAAA,YAAY,EAAM,EAAM,EAAG,CAAM,EAAI,CAC9C"}
1
+ {"version":3,"file":"random.cjs","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":"gCAeA,SAAgB,EAAO,EAAa,EAAa,EAA+B,CAC9E,GAAI,EAAM,EAAK,MAAU,WAAW,8DAA8D,EAElG,OAAO,EAAA,YAAY,EAAM,EAAM,EAAG,CAAM,EAAI,CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/random/random.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAI9E"}
1
+ {"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/random/random.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAI9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"random.js","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":";;AAgBA,SAAgB,EAAO,GAAa,GAAa,GAA+B;CAC9E,IAAI,IAAM,GAAK,MAAU,WAAW,8DAA8D;CAElG,OAAO,EAAY,IAAM,IAAM,GAAG,CAAM,IAAI;AAC9C"}
1
+ {"version":3,"file":"random.js","names":[],"sources":["../../src/random/random.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Generates a random integer between two values, inclusive.\n *\n * @example\n * ```ts\n * random(1, 10); // a random integer between 1 and 10\n * ```\n *\n * @param min - The minimum value.\n * @param max - The maximum value.\n * @returns A random integer between min and max.\n */\nexport function random(min: number, max: number, source?: RandomSource): number {\n if (min > max) throw new RangeError('random: minimum value must not be greater than maximum value');\n\n return randomIndex(max - min + 1, source) + min;\n}\n"],"mappings":";;AAeA,SAAgB,EAAO,GAAa,GAAa,GAA+B;CAC9E,IAAI,IAAM,GAAK,MAAU,WAAW,8DAA8D;CAElG,OAAO,EAAY,IAAM,IAAM,GAAG,CAAM,IAAI;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"shuffle.cjs","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"gCAcA,SAAgB,EAAW,EAAY,EAA4B,CACjE,IAAM,EAAS,CAAC,GAAG,CAAK,EAExB,IAAK,IAAI,EAAI,EAAO,OAAS,EAAG,EAAI,EAAG,IAAK,CAC1C,IAAM,EAAI,EAAA,YAAY,EAAI,EAAG,CAAM,EAEnC,CAAC,EAAO,GAAI,EAAO,IAAM,CAAC,EAAO,GAAI,EAAO,EAAE,CAChD,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"shuffle.cjs","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":"gCAaA,SAAgB,EAAW,EAAY,EAA4B,CACjE,IAAM,EAAS,CAAC,GAAG,CAAK,EAExB,IAAK,IAAI,EAAI,EAAO,OAAS,EAAG,EAAI,EAAG,IAAK,CAC1C,IAAM,EAAI,EAAA,YAAY,EAAI,EAAG,CAAM,EAEnC,CAAC,EAAO,GAAI,EAAO,IAAM,CAAC,EAAO,GAAI,EAAO,EAAE,CAChD,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"shuffle.d.ts","sourceRoot":"","sources":["../../src/random/shuffle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,EAAE,CAUjE"}
1
+ {"version":3,"file":"shuffle.d.ts","sourceRoot":"","sources":["../../src/random/shuffle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,EAAE,CAUjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"shuffle.js","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import type { RandomSource } from './source';\n\nimport { randomIndex } from './_index';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":";;AAcA,SAAgB,EAAW,GAAY,GAA4B;CACjE,IAAM,IAAS,CAAC,GAAG,CAAK;CAExB,KAAK,IAAI,IAAI,EAAO,SAAS,GAAG,IAAI,GAAG,KAAK;EAC1C,IAAM,IAAI,EAAY,IAAI,GAAG,CAAM;EAEnC,CAAC,EAAO,IAAI,EAAO,MAAM,CAAC,EAAO,IAAI,EAAO,EAAE;CAChD;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"shuffle.js","names":[],"sources":["../../src/random/shuffle.ts"],"sourcesContent":["import { randomIndex } from './_index';\nimport type { RandomSource } from './source';\n\n/**\n * Returns a new randomly-shuffled copy of the array using Fisher-Yates\n * with `crypto.getRandomValues`. Does not mutate the input.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, 4];\n * shuffle(arr); // e.g. [3, 1, 4, 2]\n * ```\n */\nexport function shuffle<T>(array: T[], source?: RandomSource): T[] {\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = randomIndex(i + 1, source);\n\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n"],"mappings":";;AAaA,SAAgB,EAAW,GAAY,GAA4B;CACjE,IAAM,IAAS,CAAC,GAAG,CAAK;CAExB,KAAK,IAAI,IAAI,EAAO,SAAS,GAAG,IAAI,GAAG,KAAK;EAC1C,IAAM,IAAI,EAAY,IAAI,GAAG,CAAM;EAEnC,CAAC,EAAO,IAAI,EAAO,MAAM,CAAC,EAAO,IAAI,EAAO,EAAE;CAChD;CAEA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "@vielzeug/arsenal",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Tree-shakeable TypeScript utility library — array, object, string, async, cache, math, and more",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/helmuthdu/vielzeug",
8
+ "directory": "packages/arsenal"
9
+ },
5
10
  "type": "module",
11
+ "engines": {
12
+ "node": ">=22"
13
+ },
6
14
  "files": [
7
15
  "dist"
8
16
  ],
9
- "sideEffects": false,
10
17
  "main": "./dist/index.cjs",
11
18
  "module": "./dist/index.js",
12
19
  "types": "dist/index.d.ts",
@@ -62,31 +69,6 @@
62
69
  "require": "./dist/string/index.cjs"
63
70
  }
64
71
  },
65
- "scripts": {
66
- "build": "pnpm run verify:exports && vite build && pnpm run build:bundle && pnpm run build:types",
67
- "build:types": "tsc -p tsconfig.declarations.json",
68
- "fix": "eslint --fix src",
69
- "lint": "eslint src",
70
- "prepublishOnly": "pnpm run build",
71
- "preview": "vite preview",
72
- "test": "pnpm run verify:exports && vitest",
73
- "sync:exports": "node ./scripts/sync-exports.mjs",
74
- "verify:exports": "node ./scripts/sync-exports.mjs --check",
75
- "build:bundle": "vite build --config vite.bundle.config.ts"
76
- },
77
- "publishConfig": {
78
- "access": "public",
79
- "registry": "https://registry.npmjs.org/"
80
- },
81
- "engines": {
82
- "node": ">=22"
83
- },
84
- "devDependencies": {
85
- "@types/node": "^26.1.2",
86
- "typescript": "^6.0.3",
87
- "vite": "^8.2.0",
88
- "vitest": "^4.1.10"
89
- },
90
72
  "typesVersions": {
91
73
  "*": {
92
74
  "array": [
@@ -117,5 +99,28 @@
117
99
  "dist/string/index.d.ts"
118
100
  ]
119
101
  }
102
+ },
103
+ "sideEffects": false,
104
+ "publishConfig": {
105
+ "access": "public",
106
+ "registry": "https://registry.npmjs.org/"
107
+ },
108
+ "scripts": {
109
+ "build": "pnpm run verify:exports && vite build && pnpm run build:bundle && pnpm run build:types",
110
+ "build:bundle": "vite build --config vite.bundle.config.ts",
111
+ "build:types": "tsc -p tsconfig.declarations.json",
112
+ "fix": "biome check --write src",
113
+ "lint": "biome ci src",
114
+ "prepublishOnly": "pnpm run build",
115
+ "preview": "vite preview",
116
+ "sync:exports": "node ./scripts/sync-exports.mjs",
117
+ "test": "pnpm run verify:exports && vitest",
118
+ "verify:exports": "node ./scripts/sync-exports.mjs --check"
119
+ },
120
+ "devDependencies": {
121
+ "@types/node": "^26.2.0",
122
+ "typescript": "^6.0.3",
123
+ "vite": "^8.2.1",
124
+ "vitest": "^4.1.10"
120
125
  }
121
126
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * Makes any promise abort-aware via AbortSignal.
3
- */
4
- export declare function abortable<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
5
- //# sourceMappingURL=_abortable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_abortable.d.ts","sourceRoot":"","sources":["../../src/_common/_abortable.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAejF"}