@vielzeug/arsenal 2.1.0 → 26.10.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 (607) hide show
  1. package/README.md +5 -18
  2. package/dist/_common/_lruMap.cjs +1 -1
  3. package/dist/_common/_lruMap.cjs.map +1 -1
  4. package/dist/_common/_lruMap.js +1 -17
  5. package/dist/_common/_lruMap.js.map +1 -1
  6. package/dist/_common/_selectorSet.cjs +1 -1
  7. package/dist/_common/_selectorSet.cjs.map +1 -1
  8. package/dist/_common/_selectorSet.js +1 -15
  9. package/dist/_common/_selectorSet.js.map +1 -1
  10. package/dist/_common/unsafePaths.cjs +1 -1
  11. package/dist/_common/unsafePaths.cjs.map +1 -1
  12. package/dist/_common/unsafePaths.js +1 -12
  13. package/dist/_common/unsafePaths.js.map +1 -1
  14. package/dist/_dev.cjs +1 -1
  15. package/dist/_dev.cjs.map +1 -1
  16. package/dist/_dev.js +1 -5
  17. package/dist/_dev.js.map +1 -1
  18. package/dist/array/chunk.cjs +1 -1
  19. package/dist/array/chunk.cjs.map +1 -1
  20. package/dist/array/chunk.d.ts +1 -1
  21. package/dist/array/chunk.d.ts.map +1 -1
  22. package/dist/array/chunk.js +1 -9
  23. package/dist/array/chunk.js.map +1 -1
  24. package/dist/array/compact.cjs +1 -1
  25. package/dist/array/compact.cjs.map +1 -1
  26. package/dist/array/compact.d.ts +1 -1
  27. package/dist/array/compact.d.ts.map +1 -1
  28. package/dist/array/compact.js +1 -7
  29. package/dist/array/compact.js.map +1 -1
  30. package/dist/array/compare.cjs +1 -1
  31. package/dist/array/compare.cjs.map +1 -1
  32. package/dist/array/compare.js +1 -18
  33. package/dist/array/compare.js.map +1 -1
  34. package/dist/array/compareBy.cjs +1 -1
  35. package/dist/array/compareBy.cjs.map +1 -1
  36. package/dist/array/compareBy.js +1 -15
  37. package/dist/array/compareBy.js.map +1 -1
  38. package/dist/array/contains.cjs +1 -1
  39. package/dist/array/contains.cjs.map +1 -1
  40. package/dist/array/contains.d.ts +1 -1
  41. package/dist/array/contains.d.ts.map +1 -1
  42. package/dist/array/contains.js +1 -8
  43. package/dist/array/contains.js.map +1 -1
  44. package/dist/array/countBy.cjs +1 -1
  45. package/dist/array/countBy.cjs.map +1 -1
  46. package/dist/array/countBy.d.ts +1 -1
  47. package/dist/array/countBy.d.ts.map +1 -1
  48. package/dist/array/countBy.js +1 -13
  49. package/dist/array/countBy.js.map +1 -1
  50. package/dist/array/difference.cjs +1 -1
  51. package/dist/array/difference.cjs.map +1 -1
  52. package/dist/array/difference.d.ts +4 -2
  53. package/dist/array/difference.d.ts.map +1 -1
  54. package/dist/array/difference.js +1 -13
  55. package/dist/array/difference.js.map +1 -1
  56. package/dist/array/drop.cjs +1 -1
  57. package/dist/array/drop.cjs.map +1 -1
  58. package/dist/array/drop.d.ts +1 -1
  59. package/dist/array/drop.d.ts.map +1 -1
  60. package/dist/array/drop.js +1 -8
  61. package/dist/array/drop.js.map +1 -1
  62. package/dist/array/dropLast.cjs +1 -1
  63. package/dist/array/dropLast.cjs.map +1 -1
  64. package/dist/array/dropLast.d.ts +1 -1
  65. package/dist/array/dropLast.d.ts.map +1 -1
  66. package/dist/array/dropLast.js +1 -8
  67. package/dist/array/dropLast.js.map +1 -1
  68. package/dist/array/filterMap.cjs +1 -1
  69. package/dist/array/filterMap.cjs.map +1 -1
  70. package/dist/array/filterMap.d.ts +3 -1
  71. package/dist/array/filterMap.d.ts.map +1 -1
  72. package/dist/array/filterMap.js +1 -12
  73. package/dist/array/filterMap.js.map +1 -1
  74. package/dist/array/first.cjs +1 -1
  75. package/dist/array/first.cjs.map +1 -1
  76. package/dist/array/first.d.ts +1 -1
  77. package/dist/array/first.d.ts.map +1 -1
  78. package/dist/array/first.js +1 -7
  79. package/dist/array/first.js.map +1 -1
  80. package/dist/array/groupBy.cjs +1 -1
  81. package/dist/array/groupBy.cjs.map +1 -1
  82. package/dist/array/groupBy.d.ts +1 -1
  83. package/dist/array/groupBy.d.ts.map +1 -1
  84. package/dist/array/groupBy.js +1 -13
  85. package/dist/array/groupBy.js.map +1 -1
  86. package/dist/array/index.cjs +1 -1
  87. package/dist/array/index.d.ts +0 -1
  88. package/dist/array/index.d.ts.map +1 -1
  89. package/dist/array/index.js +1 -29
  90. package/dist/array/indexBy.cjs +1 -1
  91. package/dist/array/indexBy.cjs.map +1 -1
  92. package/dist/array/indexBy.d.ts +1 -1
  93. package/dist/array/indexBy.d.ts.map +1 -1
  94. package/dist/array/indexBy.js +1 -13
  95. package/dist/array/indexBy.js.map +1 -1
  96. package/dist/array/intersection.cjs +1 -1
  97. package/dist/array/intersection.cjs.map +1 -1
  98. package/dist/array/intersection.d.ts +4 -2
  99. package/dist/array/intersection.d.ts.map +1 -1
  100. package/dist/array/intersection.js +1 -13
  101. package/dist/array/intersection.js.map +1 -1
  102. package/dist/array/last.cjs +1 -1
  103. package/dist/array/last.cjs.map +1 -1
  104. package/dist/array/last.d.ts +1 -1
  105. package/dist/array/last.d.ts.map +1 -1
  106. package/dist/array/last.js +1 -7
  107. package/dist/array/last.js.map +1 -1
  108. package/dist/array/partition.cjs +1 -1
  109. package/dist/array/partition.cjs.map +1 -1
  110. package/dist/array/partition.d.ts +3 -1
  111. package/dist/array/partition.d.ts.map +1 -1
  112. package/dist/array/partition.js +1 -9
  113. package/dist/array/partition.js.map +1 -1
  114. package/dist/array/replace.cjs +1 -1
  115. package/dist/array/replace.cjs.map +1 -1
  116. package/dist/array/replace.d.ts +2 -15
  117. package/dist/array/replace.d.ts.map +1 -1
  118. package/dist/array/replace.js +1 -12
  119. package/dist/array/replace.js.map +1 -1
  120. package/dist/array/rotate.cjs +1 -1
  121. package/dist/array/rotate.cjs.map +1 -1
  122. package/dist/array/rotate.d.ts +5 -17
  123. package/dist/array/rotate.d.ts.map +1 -1
  124. package/dist/array/rotate.js +1 -9
  125. package/dist/array/rotate.js.map +1 -1
  126. package/dist/array/search.cjs +1 -1
  127. package/dist/array/search.cjs.map +1 -1
  128. package/dist/array/search.js +1 -29
  129. package/dist/array/search.js.map +1 -1
  130. package/dist/array/sort.cjs +1 -1
  131. package/dist/array/sort.cjs.map +1 -1
  132. package/dist/array/sort.d.ts +2 -2
  133. package/dist/array/sort.d.ts.map +1 -1
  134. package/dist/array/sort.js +1 -14
  135. package/dist/array/sort.js.map +1 -1
  136. package/dist/array/take.cjs +1 -1
  137. package/dist/array/take.cjs.map +1 -1
  138. package/dist/array/take.d.ts +1 -1
  139. package/dist/array/take.d.ts.map +1 -1
  140. package/dist/array/take.js +1 -8
  141. package/dist/array/take.js.map +1 -1
  142. package/dist/array/takeLast.cjs +1 -1
  143. package/dist/array/takeLast.cjs.map +1 -1
  144. package/dist/array/takeLast.d.ts +1 -1
  145. package/dist/array/takeLast.d.ts.map +1 -1
  146. package/dist/array/takeLast.js +1 -8
  147. package/dist/array/takeLast.js.map +1 -1
  148. package/dist/array/toggle.cjs +1 -1
  149. package/dist/array/toggle.cjs.map +1 -1
  150. package/dist/array/toggle.d.ts +1 -1
  151. package/dist/array/toggle.d.ts.map +1 -1
  152. package/dist/array/toggle.js +1 -8
  153. package/dist/array/toggle.js.map +1 -1
  154. package/dist/array/union.cjs +1 -1
  155. package/dist/array/union.cjs.map +1 -1
  156. package/dist/array/union.d.ts +4 -2
  157. package/dist/array/union.d.ts.map +1 -1
  158. package/dist/array/union.js +1 -8
  159. package/dist/array/union.js.map +1 -1
  160. package/dist/array/uniq.cjs +1 -1
  161. package/dist/array/uniq.cjs.map +1 -1
  162. package/dist/array/uniq.d.ts +1 -1
  163. package/dist/array/uniq.d.ts.map +1 -1
  164. package/dist/array/uniq.js +1 -8
  165. package/dist/array/uniq.js.map +1 -1
  166. package/dist/array/unzip.cjs +1 -1
  167. package/dist/array/unzip.cjs.map +1 -1
  168. package/dist/array/unzip.js +1 -10
  169. package/dist/array/unzip.js.map +1 -1
  170. package/dist/array/zip.cjs +1 -1
  171. package/dist/array/zip.cjs.map +1 -1
  172. package/dist/array/zip.d.ts +1 -1
  173. package/dist/array/zip.d.ts.map +1 -1
  174. package/dist/array/zip.js +1 -10
  175. package/dist/array/zip.js.map +1 -1
  176. package/dist/arsenal.cjs +1 -1
  177. package/dist/arsenal.cjs.map +1 -1
  178. package/dist/arsenal.iife.js +1 -1
  179. package/dist/arsenal.iife.js.map +1 -1
  180. package/dist/arsenal.js +1 -1
  181. package/dist/arsenal.js.map +1 -1
  182. package/dist/async/abortError.cjs +1 -1
  183. package/dist/async/abortError.cjs.map +1 -1
  184. package/dist/async/abortError.d.ts +3 -2
  185. package/dist/async/abortError.d.ts.map +1 -1
  186. package/dist/async/abortError.js +1 -7
  187. package/dist/async/abortError.js.map +1 -1
  188. package/dist/async/abortable.cjs +1 -1
  189. package/dist/async/abortable.cjs.map +1 -1
  190. package/dist/async/abortable.js +1 -11
  191. package/dist/async/abortable.js.map +1 -1
  192. package/dist/async/attempt.cjs +1 -1
  193. package/dist/async/attempt.cjs.map +1 -1
  194. package/dist/async/attempt.js +1 -23
  195. package/dist/async/attempt.js.map +1 -1
  196. package/dist/async/backoff.cjs +1 -1
  197. package/dist/async/backoff.cjs.map +1 -1
  198. package/dist/async/backoff.js +1 -7
  199. package/dist/async/backoff.js.map +1 -1
  200. package/dist/async/index.js +1 -10
  201. package/dist/async/parallel.cjs +1 -1
  202. package/dist/async/parallel.cjs.map +1 -1
  203. package/dist/async/parallel.js +1 -24
  204. package/dist/async/parallel.js.map +1 -1
  205. package/dist/async/retry.cjs +1 -1
  206. package/dist/async/retry.cjs.map +1 -1
  207. package/dist/async/retry.d.ts +4 -6
  208. package/dist/async/retry.d.ts.map +1 -1
  209. package/dist/async/retry.js +1 -24
  210. package/dist/async/retry.js.map +1 -1
  211. package/dist/async/sleep.cjs +1 -1
  212. package/dist/async/sleep.cjs.map +1 -1
  213. package/dist/async/sleep.js +1 -15
  214. package/dist/async/sleep.js.map +1 -1
  215. package/dist/async/taskPool.cjs +1 -1
  216. package/dist/async/taskPool.cjs.map +1 -1
  217. package/dist/async/taskPool.js +1 -50
  218. package/dist/async/taskPool.js.map +1 -1
  219. package/dist/async/waitFor.cjs +1 -1
  220. package/dist/async/waitFor.cjs.map +1 -1
  221. package/dist/async/waitFor.js +1 -12
  222. package/dist/async/waitFor.js.map +1 -1
  223. package/dist/cache/cache.cjs +1 -1
  224. package/dist/cache/cache.cjs.map +1 -1
  225. package/dist/cache/cache.d.ts +1 -0
  226. package/dist/cache/cache.d.ts.map +1 -1
  227. package/dist/cache/cache.js +1 -58
  228. package/dist/cache/cache.js.map +1 -1
  229. package/dist/cache/index.js +1 -3
  230. package/dist/cache/memo.cjs +1 -1
  231. package/dist/cache/memo.cjs.map +1 -1
  232. package/dist/cache/memo.js +1 -37
  233. package/dist/cache/memo.js.map +1 -1
  234. package/dist/encoding/base64url.cjs +2 -0
  235. package/dist/encoding/base64url.cjs.map +1 -0
  236. package/dist/encoding/base64url.d.ts +9 -0
  237. package/dist/encoding/base64url.d.ts.map +1 -0
  238. package/dist/encoding/base64url.js +2 -0
  239. package/dist/encoding/base64url.js.map +1 -0
  240. package/dist/encoding/index.cjs +1 -0
  241. package/dist/encoding/index.d.ts +2 -0
  242. package/dist/encoding/index.d.ts.map +1 -0
  243. package/dist/encoding/index.js +1 -0
  244. package/dist/errors.cjs +1 -1
  245. package/dist/errors.cjs.map +1 -1
  246. package/dist/errors.js +1 -9
  247. package/dist/errors.js.map +1 -1
  248. package/dist/function/assert.cjs +1 -1
  249. package/dist/function/assert.cjs.map +1 -1
  250. package/dist/function/assert.d.ts +1 -1
  251. package/dist/function/assert.js +1 -7
  252. package/dist/function/assert.js.map +1 -1
  253. package/dist/function/debounce.cjs +1 -1
  254. package/dist/function/debounce.cjs.map +1 -1
  255. package/dist/function/debounce.js +1 -26
  256. package/dist/function/debounce.js.map +1 -1
  257. package/dist/function/index.cjs +1 -1
  258. package/dist/function/index.d.ts +1 -0
  259. package/dist/function/index.d.ts.map +1 -1
  260. package/dist/function/index.js +1 -8
  261. package/dist/function/once.cjs +1 -1
  262. package/dist/function/once.cjs.map +1 -1
  263. package/dist/function/once.js +1 -10
  264. package/dist/function/once.js.map +1 -1
  265. package/dist/function/pipe.cjs +1 -1
  266. package/dist/function/pipe.cjs.map +1 -1
  267. package/dist/function/pipe.js +1 -9
  268. package/dist/function/pipe.js.map +1 -1
  269. package/dist/function/runAll.cjs +1 -1
  270. package/dist/function/runAll.cjs.map +1 -1
  271. package/dist/function/runAll.js +1 -18
  272. package/dist/function/runAll.js.map +1 -1
  273. package/dist/function/tap.cjs +1 -1
  274. package/dist/function/tap.cjs.map +1 -1
  275. package/dist/function/tap.js +1 -7
  276. package/dist/function/tap.js.map +1 -1
  277. package/dist/function/tapper.cjs +2 -0
  278. package/dist/function/tapper.cjs.map +1 -0
  279. package/dist/function/tapper.d.ts +27 -0
  280. package/dist/function/tapper.d.ts.map +1 -0
  281. package/dist/function/tapper.js +2 -0
  282. package/dist/function/tapper.js.map +1 -0
  283. package/dist/function/throttle.cjs +1 -1
  284. package/dist/function/throttle.cjs.map +1 -1
  285. package/dist/function/throttle.js +1 -35
  286. package/dist/function/throttle.js.map +1 -1
  287. package/dist/guards/combinators.cjs +1 -1
  288. package/dist/guards/combinators.cjs.map +1 -1
  289. package/dist/guards/combinators.js +1 -16
  290. package/dist/guards/combinators.js.map +1 -1
  291. package/dist/guards/index.cjs +1 -1
  292. package/dist/guards/index.js +1 -17
  293. package/dist/guards/isAbortError.cjs +1 -1
  294. package/dist/guards/isAbortError.cjs.map +1 -1
  295. package/dist/guards/isAbortError.js +1 -7
  296. package/dist/guards/isAbortError.js.map +1 -1
  297. package/dist/guards/isDate.cjs +1 -1
  298. package/dist/guards/isDate.cjs.map +1 -1
  299. package/dist/guards/isDate.js +1 -7
  300. package/dist/guards/isDate.js.map +1 -1
  301. package/dist/guards/isDefined.cjs +1 -1
  302. package/dist/guards/isDefined.cjs.map +1 -1
  303. package/dist/guards/isDefined.js +1 -7
  304. package/dist/guards/isDefined.js.map +1 -1
  305. package/dist/guards/isEmpty.cjs +1 -1
  306. package/dist/guards/isEmpty.cjs.map +1 -1
  307. package/dist/guards/isEmpty.d.ts.map +1 -1
  308. package/dist/guards/isEmpty.js +1 -9
  309. package/dist/guards/isEmpty.js.map +1 -1
  310. package/dist/guards/isEqual.cjs +1 -1
  311. package/dist/guards/isEqual.cjs.map +1 -1
  312. package/dist/guards/isEqual.js +1 -33
  313. package/dist/guards/isEqual.js.map +1 -1
  314. package/dist/guards/isError.cjs +1 -1
  315. package/dist/guards/isError.cjs.map +1 -1
  316. package/dist/guards/isError.js +1 -7
  317. package/dist/guards/isError.js.map +1 -1
  318. package/dist/guards/isFunction.cjs +1 -1
  319. package/dist/guards/isFunction.cjs.map +1 -1
  320. package/dist/guards/isFunction.d.ts +1 -1
  321. package/dist/guards/isFunction.d.ts.map +1 -1
  322. package/dist/guards/isFunction.js +1 -7
  323. package/dist/guards/isFunction.js.map +1 -1
  324. package/dist/guards/isMatch.cjs +1 -1
  325. package/dist/guards/isMatch.cjs.map +1 -1
  326. package/dist/guards/isMatch.js +1 -22
  327. package/dist/guards/isMatch.js.map +1 -1
  328. package/dist/guards/isNil.cjs +1 -1
  329. package/dist/guards/isNil.cjs.map +1 -1
  330. package/dist/guards/isNil.js +1 -7
  331. package/dist/guards/isNil.js.map +1 -1
  332. package/dist/guards/isNumber.cjs +1 -1
  333. package/dist/guards/isNumber.cjs.map +1 -1
  334. package/dist/guards/isNumber.js +1 -7
  335. package/dist/guards/isNumber.js.map +1 -1
  336. package/dist/guards/isPlainObject.cjs +1 -1
  337. package/dist/guards/isPlainObject.cjs.map +1 -1
  338. package/dist/guards/isPlainObject.js +1 -9
  339. package/dist/guards/isPlainObject.js.map +1 -1
  340. package/dist/guards/isPrimitive.cjs +1 -1
  341. package/dist/guards/isPrimitive.cjs.map +1 -1
  342. package/dist/guards/isPrimitive.d.ts +4 -17
  343. package/dist/guards/isPrimitive.d.ts.map +1 -1
  344. package/dist/guards/isPrimitive.js +1 -8
  345. package/dist/guards/isPrimitive.js.map +1 -1
  346. package/dist/guards/isPromise.cjs +1 -1
  347. package/dist/guards/isPromise.cjs.map +1 -1
  348. package/dist/guards/isPromise.js +1 -7
  349. package/dist/guards/isPromise.js.map +1 -1
  350. package/dist/guards/isRegex.cjs +1 -1
  351. package/dist/guards/isRegex.cjs.map +1 -1
  352. package/dist/guards/isRegex.js +1 -7
  353. package/dist/guards/isRegex.js.map +1 -1
  354. package/dist/guards/shallowEqual.cjs +1 -1
  355. package/dist/guards/shallowEqual.cjs.map +1 -1
  356. package/dist/guards/shallowEqual.js +1 -19
  357. package/dist/guards/shallowEqual.js.map +1 -1
  358. package/dist/index.cjs +1 -1
  359. package/dist/index.d.ts +13 -1
  360. package/dist/index.d.ts.map +1 -1
  361. package/dist/index.js +1 -30
  362. package/dist/math/allocate.cjs +1 -1
  363. package/dist/math/allocate.cjs.map +1 -1
  364. package/dist/math/allocate.js +1 -18
  365. package/dist/math/allocate.js.map +1 -1
  366. package/dist/math/average.cjs +1 -1
  367. package/dist/math/average.cjs.map +1 -1
  368. package/dist/math/average.d.ts +3 -2
  369. package/dist/math/average.d.ts.map +1 -1
  370. package/dist/math/average.js +1 -13
  371. package/dist/math/average.js.map +1 -1
  372. package/dist/math/clamp.cjs +1 -1
  373. package/dist/math/clamp.cjs.map +1 -1
  374. package/dist/math/clamp.js +1 -7
  375. package/dist/math/clamp.js.map +1 -1
  376. package/dist/math/gcd.cjs +1 -1
  377. package/dist/math/gcd.cjs.map +1 -1
  378. package/dist/math/gcd.d.ts.map +1 -1
  379. package/dist/math/gcd.js +1 -12
  380. package/dist/math/gcd.js.map +1 -1
  381. package/dist/math/index.cjs +1 -1
  382. package/dist/math/index.d.ts +0 -1
  383. package/dist/math/index.d.ts.map +1 -1
  384. package/dist/math/index.js +1 -17
  385. package/dist/math/lcm.cjs +1 -1
  386. package/dist/math/lcm.cjs.map +1 -1
  387. package/dist/math/lcm.d.ts.map +1 -1
  388. package/dist/math/lcm.js +1 -8
  389. package/dist/math/lcm.js.map +1 -1
  390. package/dist/math/lerp.cjs +1 -1
  391. package/dist/math/lerp.cjs.map +1 -1
  392. package/dist/math/lerp.js +1 -7
  393. package/dist/math/lerp.js.map +1 -1
  394. package/dist/math/linspace.cjs +1 -1
  395. package/dist/math/linspace.cjs.map +1 -1
  396. package/dist/math/linspace.d.ts.map +1 -1
  397. package/dist/math/linspace.js +1 -10
  398. package/dist/math/linspace.js.map +1 -1
  399. package/dist/math/median.cjs +1 -1
  400. package/dist/math/median.cjs.map +1 -1
  401. package/dist/math/median.d.ts +1 -1
  402. package/dist/math/median.d.ts.map +1 -1
  403. package/dist/math/median.js +1 -11
  404. package/dist/math/median.js.map +1 -1
  405. package/dist/math/mod.cjs +1 -1
  406. package/dist/math/mod.cjs.map +1 -1
  407. package/dist/math/mod.js +1 -8
  408. package/dist/math/mod.js.map +1 -1
  409. package/dist/math/normalize.cjs +1 -1
  410. package/dist/math/normalize.cjs.map +1 -1
  411. package/dist/math/normalize.js +1 -8
  412. package/dist/math/normalize.js.map +1 -1
  413. package/dist/math/range.cjs +1 -1
  414. package/dist/math/range.cjs.map +1 -1
  415. package/dist/math/range.js +1 -25
  416. package/dist/math/range.js.map +1 -1
  417. package/dist/math/round.cjs +1 -1
  418. package/dist/math/round.cjs.map +1 -1
  419. package/dist/math/round.js +1 -9
  420. package/dist/math/round.js.map +1 -1
  421. package/dist/math/standardDeviation.cjs +1 -1
  422. package/dist/math/standardDeviation.cjs.map +1 -1
  423. package/dist/math/standardDeviation.d.ts +1 -1
  424. package/dist/math/standardDeviation.d.ts.map +1 -1
  425. package/dist/math/standardDeviation.js +1 -8
  426. package/dist/math/standardDeviation.js.map +1 -1
  427. package/dist/math/sum.cjs +1 -1
  428. package/dist/math/sum.cjs.map +1 -1
  429. package/dist/math/sum.d.ts +1 -1
  430. package/dist/math/sum.d.ts.map +1 -1
  431. package/dist/math/sum.js +1 -11
  432. package/dist/math/sum.js.map +1 -1
  433. package/dist/math/variance.cjs +1 -1
  434. package/dist/math/variance.cjs.map +1 -1
  435. package/dist/math/variance.d.ts +1 -1
  436. package/dist/math/variance.d.ts.map +1 -1
  437. package/dist/math/variance.js +1 -10
  438. package/dist/math/variance.js.map +1 -1
  439. package/dist/object/defaults.cjs +1 -1
  440. package/dist/object/defaults.cjs.map +1 -1
  441. package/dist/object/defaults.js +1 -11
  442. package/dist/object/defaults.js.map +1 -1
  443. package/dist/object/diff.cjs +1 -1
  444. package/dist/object/diff.cjs.map +1 -1
  445. package/dist/object/diff.d.ts +1 -1
  446. package/dist/object/diff.d.ts.map +1 -1
  447. package/dist/object/diff.js +1 -26
  448. package/dist/object/diff.js.map +1 -1
  449. package/dist/object/filterValues.cjs +1 -1
  450. package/dist/object/filterValues.cjs.map +1 -1
  451. package/dist/object/filterValues.js +1 -10
  452. package/dist/object/filterValues.js.map +1 -1
  453. package/dist/object/flattenPaths.cjs +1 -1
  454. package/dist/object/flattenPaths.cjs.map +1 -1
  455. package/dist/object/flattenPaths.js +1 -30
  456. package/dist/object/flattenPaths.js.map +1 -1
  457. package/dist/object/getPath.cjs +1 -1
  458. package/dist/object/getPath.cjs.map +1 -1
  459. package/dist/object/getPath.js +1 -25
  460. package/dist/object/getPath.js.map +1 -1
  461. package/dist/object/hash.cjs +1 -1
  462. package/dist/object/hash.cjs.map +1 -1
  463. package/dist/object/hash.js +1 -27
  464. package/dist/object/hash.js.map +1 -1
  465. package/dist/object/index.js +1 -15
  466. package/dist/object/invert.cjs +1 -1
  467. package/dist/object/invert.cjs.map +1 -1
  468. package/dist/object/invert.js +1 -10
  469. package/dist/object/invert.js.map +1 -1
  470. package/dist/object/mapKeys.cjs +1 -1
  471. package/dist/object/mapKeys.cjs.map +1 -1
  472. package/dist/object/mapKeys.js +1 -14
  473. package/dist/object/mapKeys.js.map +1 -1
  474. package/dist/object/mapValues.cjs +1 -1
  475. package/dist/object/mapValues.cjs.map +1 -1
  476. package/dist/object/mapValues.js +1 -10
  477. package/dist/object/mapValues.js.map +1 -1
  478. package/dist/object/merge.cjs +1 -1
  479. package/dist/object/merge.cjs.map +1 -1
  480. package/dist/object/merge.js +1 -25
  481. package/dist/object/merge.js.map +1 -1
  482. package/dist/object/omit.cjs +1 -1
  483. package/dist/object/omit.cjs.map +1 -1
  484. package/dist/object/omit.js +1 -10
  485. package/dist/object/omit.js.map +1 -1
  486. package/dist/object/pick.cjs +1 -1
  487. package/dist/object/pick.cjs.map +1 -1
  488. package/dist/object/pick.js +1 -10
  489. package/dist/object/pick.js.map +1 -1
  490. package/dist/object/prune.cjs +1 -1
  491. package/dist/object/prune.cjs.map +1 -1
  492. package/dist/object/prune.d.ts.map +1 -1
  493. package/dist/object/prune.js +1 -34
  494. package/dist/object/prune.js.map +1 -1
  495. package/dist/object/tryParseJson.cjs +1 -1
  496. package/dist/object/tryParseJson.cjs.map +1 -1
  497. package/dist/object/tryParseJson.js +1 -17
  498. package/dist/object/tryParseJson.js.map +1 -1
  499. package/dist/random/_index.cjs +1 -1
  500. package/dist/random/_index.cjs.map +1 -1
  501. package/dist/random/_index.d.ts +1 -1
  502. package/dist/random/_index.d.ts.map +1 -1
  503. package/dist/random/_index.js +1 -9
  504. package/dist/random/_index.js.map +1 -1
  505. package/dist/random/draw.cjs +1 -1
  506. package/dist/random/draw.cjs.map +1 -1
  507. package/dist/random/draw.js +1 -20
  508. package/dist/random/draw.js.map +1 -1
  509. package/dist/random/index.cjs +1 -1
  510. package/dist/random/index.d.ts +0 -1
  511. package/dist/random/index.d.ts.map +1 -1
  512. package/dist/random/index.js +1 -5
  513. package/dist/random/random.cjs +1 -1
  514. package/dist/random/random.cjs.map +1 -1
  515. package/dist/random/random.js +1 -9
  516. package/dist/random/random.js.map +1 -1
  517. package/dist/random/shuffle.cjs +1 -1
  518. package/dist/random/shuffle.cjs.map +1 -1
  519. package/dist/random/shuffle.js +1 -13
  520. package/dist/random/shuffle.js.map +1 -1
  521. package/dist/random/source.cjs +2 -0
  522. package/dist/random/source.cjs.map +1 -0
  523. package/dist/random/source.d.ts +2 -0
  524. package/dist/random/source.d.ts.map +1 -1
  525. package/dist/random/source.js +2 -0
  526. package/dist/random/source.js.map +1 -0
  527. package/dist/string/_caseUtils.cjs +1 -1
  528. package/dist/string/_caseUtils.cjs.map +1 -1
  529. package/dist/string/_caseUtils.js +1 -12
  530. package/dist/string/_caseUtils.js.map +1 -1
  531. package/dist/string/camelCase.cjs +1 -1
  532. package/dist/string/camelCase.cjs.map +1 -1
  533. package/dist/string/camelCase.js +1 -8
  534. package/dist/string/camelCase.js.map +1 -1
  535. package/dist/string/escape.cjs +1 -1
  536. package/dist/string/escape.cjs.map +1 -1
  537. package/dist/string/escape.js +1 -14
  538. package/dist/string/escape.js.map +1 -1
  539. package/dist/string/index.cjs +1 -1
  540. package/dist/string/index.d.ts +1 -1
  541. package/dist/string/index.d.ts.map +1 -1
  542. package/dist/string/index.js +1 -12
  543. package/dist/string/kebabCase.cjs +1 -1
  544. package/dist/string/kebabCase.cjs.map +1 -1
  545. package/dist/string/kebabCase.js +1 -8
  546. package/dist/string/kebabCase.js.map +1 -1
  547. package/dist/string/padCenter.cjs +2 -0
  548. package/dist/string/padCenter.cjs.map +1 -0
  549. package/dist/string/padCenter.d.ts +3 -0
  550. package/dist/string/padCenter.d.ts.map +1 -0
  551. package/dist/string/padCenter.js +2 -0
  552. package/dist/string/padCenter.js.map +1 -0
  553. package/dist/string/pascalCase.cjs +1 -1
  554. package/dist/string/pascalCase.cjs.map +1 -1
  555. package/dist/string/pascalCase.js +1 -8
  556. package/dist/string/pascalCase.js.map +1 -1
  557. package/dist/string/similarity.cjs +1 -1
  558. package/dist/string/similarity.cjs.map +1 -1
  559. package/dist/string/similarity.js +1 -22
  560. package/dist/string/similarity.js.map +1 -1
  561. package/dist/string/snakeCase.cjs +1 -1
  562. package/dist/string/snakeCase.cjs.map +1 -1
  563. package/dist/string/snakeCase.js +1 -8
  564. package/dist/string/snakeCase.js.map +1 -1
  565. package/dist/string/titleCase.cjs +1 -1
  566. package/dist/string/titleCase.cjs.map +1 -1
  567. package/dist/string/titleCase.js +1 -8
  568. package/dist/string/titleCase.js.map +1 -1
  569. package/dist/string/truncate.cjs +1 -1
  570. package/dist/string/truncate.cjs.map +1 -1
  571. package/dist/string/truncate.js +1 -15
  572. package/dist/string/truncate.js.map +1 -1
  573. package/dist/string/unescape.cjs +1 -1
  574. package/dist/string/unescape.cjs.map +1 -1
  575. package/dist/string/unescape.js +1 -14
  576. package/dist/string/unescape.js.map +1 -1
  577. package/dist/string/words.cjs +1 -1
  578. package/dist/string/words.cjs.map +1 -1
  579. package/dist/string/words.js +1 -9
  580. package/dist/string/words.js.map +1 -1
  581. package/dist/types.d.ts +10 -0
  582. package/dist/types.d.ts.map +1 -1
  583. package/package.json +16 -8
  584. package/dist/array/flatten.cjs +0 -2
  585. package/dist/array/flatten.cjs.map +0 -1
  586. package/dist/array/flatten.d.ts +0 -5
  587. package/dist/array/flatten.d.ts.map +0 -1
  588. package/dist/array/flatten.js +0 -11
  589. package/dist/array/flatten.js.map +0 -1
  590. package/dist/math/percent.cjs +0 -2
  591. package/dist/math/percent.cjs.map +0 -1
  592. package/dist/math/percent.d.ts +0 -19
  593. package/dist/math/percent.d.ts.map +0 -1
  594. package/dist/math/percent.js +0 -8
  595. package/dist/math/percent.js.map +0 -1
  596. package/dist/random/uuid.cjs +0 -2
  597. package/dist/random/uuid.cjs.map +0 -1
  598. package/dist/random/uuid.d.ts +0 -12
  599. package/dist/random/uuid.d.ts.map +0 -1
  600. package/dist/random/uuid.js +0 -8
  601. package/dist/random/uuid.js.map +0 -1
  602. package/dist/string/pad.cjs +0 -2
  603. package/dist/string/pad.cjs.map +0 -1
  604. package/dist/string/pad.d.ts +0 -5
  605. package/dist/string/pad.d.ts.map +0 -1
  606. package/dist/string/pad.js +0 -10
  607. package/dist/string/pad.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"standardDeviation.js","names":[],"sources":["../../src/math/standardDeviation.ts"],"sourcesContent":["import { variance } from './variance';\n\n/**\n * Computes the population standard deviation (square root of `variance`) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * standardDeviation([2, 4, 4, 4, 5, 5, 7, 9]); // 2\n * standardDeviation([]); // 0\n * ```\n *\n * @param array - The array to compute standard deviation over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population standard deviation, or `0` for an empty array.\n */\nexport function standardDeviation<T>(array: T[], callback?: (item: T) => number): number {\n return Math.sqrt(variance(array, callback));\n}\n"],"mappings":";;AAgBA,SAAgB,EAAqB,GAAY,GAAwC;CACvF,OAAO,KAAK,KAAK,EAAS,GAAO,CAAQ,CAAC;AAC5C"}
1
+ {"version":3,"file":"standardDeviation.js","names":[],"sources":["../../src/math/standardDeviation.ts"],"sourcesContent":["import { variance } from './variance';\n\n/**\n * Computes the population standard deviation (square root of `variance`) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * standardDeviation([2, 4, 4, 4, 5, 5, 7, 9]); // 2\n * standardDeviation([]); // 0\n * ```\n *\n * @param array - The array to compute standard deviation over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population standard deviation, or `0` for an empty array.\n */\nexport function standardDeviation<T>(array: readonly T[], callback?: (item: T) => number): number {\n return Math.sqrt(variance(array, callback));\n}\n"],"mappings":"yCAgBA,SAAgB,kBAAqB,EAAqB,EAAwC,CAChG,OAAO,KAAK,KAAK,EAAS,EAAO,CAAQ,CAAC,CAC5C"}
package/dist/math/sum.cjs CHANGED
@@ -1,2 +1,2 @@
1
- function e(e,t){return e.length===0?0:e.reduce((e,n)=>{let r=t?t(n):n;if(typeof r!=`number`||Number.isNaN(r))throw TypeError(`sum: encountered a non-numeric value; provide a callback to map non-number items`);return e+r},0)}exports.sum=e;
1
+ function sum(e,t){return e.length===0?0:e.reduce((e,n)=>{let r=t?t(n):n;if(!Number.isFinite(r))throw TypeError(`sum: encountered a non-numeric value; provide a callback to map non-number items`);return e+r},0)}exports.sum=sum;
2
2
  //# sourceMappingURL=sum.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sum.cjs","names":[],"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Sum numbers in an array or numbers mapped by a callback function.\n *\n * @example\n * ```ts\n * sum([1, 2, 3]) // 6\n * sum([{value: 1}, {value: 2}, {value: 3}], (item) => item.value) // 6\n * sum(['apple', 'banana', 'cherry']) // TypeError\n * ```\n *\n * @param array - The array to sum.\n * @param callback - An optional callback function to map the values.\n *\n * @returns The sum of the numbers in the array or the sum of the mapped values.\n *\n * @throws {TypeError} If (after an optional `callback` mapping) any item is not a finite number.\n */\nexport function sum<T>(array: T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n return array.reduce<number>((acc, item) => {\n const val = callback ? callback(item) : (item as unknown as number);\n\n if (typeof val !== 'number' || Number.isNaN(val)) {\n throw new TypeError('sum: encountered a non-numeric value; provide a callback to map non-number items');\n }\n\n return acc + val;\n }, 0);\n}\n"],"mappings":"AAiBA,SAAgB,EAAO,EAAY,EAAwC,CAGzE,OAFI,EAAM,SAAW,EAAU,EAExB,EAAM,QAAgB,EAAK,IAAS,CACzC,IAAM,EAAM,EAAW,EAAS,CAAI,EAAK,EAEzC,GAAI,OAAO,GAAQ,UAAY,OAAO,MAAM,CAAG,EAC7C,MAAU,UAAU,kFAAkF,EAGxG,OAAO,EAAM,CACf,EAAG,CAAC,CACN"}
1
+ {"version":3,"file":"sum.cjs","names":[],"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Sum numbers in an array or numbers mapped by a callback function.\n *\n * @example\n * ```ts\n * sum([1, 2, 3]) // 6\n * sum([{value: 1}, {value: 2}, {value: 3}], (item) => item.value) // 6\n * sum(['apple', 'banana', 'cherry']) // TypeError\n * ```\n *\n * @param array - The array to sum.\n * @param callback - An optional callback function to map the values.\n *\n * @returns The sum of the numbers in the array or the sum of the mapped values.\n *\n * @throws {TypeError} If (after an optional `callback` mapping) any item is not a finite number.\n */\nexport function sum<T>(array: readonly T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n return array.reduce<number>((acc, item) => {\n const val = callback ? callback(item) : (item as unknown as number);\n\n if (!Number.isFinite(val)) {\n throw new TypeError('sum: encountered a non-numeric value; provide a callback to map non-number items');\n }\n\n return acc + val;\n }, 0);\n}\n"],"mappings":"AAiBA,SAAgB,IAAO,EAAqB,EAAwC,CAGlF,OAFI,EAAM,SAAW,EAAU,EAExB,EAAM,QAAgB,EAAK,IAAS,CACzC,IAAM,EAAM,EAAW,EAAS,CAAI,EAAK,EAEzC,GAAI,CAAC,OAAO,SAAS,CAAG,EACtB,MAAU,UAAU,kFAAkF,EAGxG,OAAO,EAAM,CACf,EAAG,CAAC,CACN"}
@@ -15,5 +15,5 @@
15
15
  *
16
16
  * @throws {TypeError} If (after an optional `callback` mapping) any item is not a finite number.
17
17
  */
18
- export declare function sum<T>(array: T[], callback?: (item: T) => number): number;
18
+ export declare function sum<T>(array: readonly T[], callback?: (item: T) => number): number;
19
19
  //# sourceMappingURL=sum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sum.d.ts","sourceRoot":"","sources":["../../src/math/sum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAYzE"}
1
+ {"version":3,"file":"sum.d.ts","sourceRoot":"","sources":["../../src/math/sum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAYlF"}
package/dist/math/sum.js CHANGED
@@ -1,12 +1,2 @@
1
- //#region src/math/sum.ts
2
- function e(e, t) {
3
- return e.length === 0 ? 0 : e.reduce((e, n) => {
4
- let r = t ? t(n) : n;
5
- if (typeof r != "number" || Number.isNaN(r)) throw TypeError("sum: encountered a non-numeric value; provide a callback to map non-number items");
6
- return e + r;
7
- }, 0);
8
- }
9
- //#endregion
10
- export { e as sum };
11
-
1
+ function sum(e,t){return e.length===0?0:e.reduce((e,n)=>{let r=t?t(n):n;if(!Number.isFinite(r))throw TypeError(`sum: encountered a non-numeric value; provide a callback to map non-number items`);return e+r},0)}export{sum};
12
2
  //# sourceMappingURL=sum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sum.js","names":[],"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Sum numbers in an array or numbers mapped by a callback function.\n *\n * @example\n * ```ts\n * sum([1, 2, 3]) // 6\n * sum([{value: 1}, {value: 2}, {value: 3}], (item) => item.value) // 6\n * sum(['apple', 'banana', 'cherry']) // TypeError\n * ```\n *\n * @param array - The array to sum.\n * @param callback - An optional callback function to map the values.\n *\n * @returns The sum of the numbers in the array or the sum of the mapped values.\n *\n * @throws {TypeError} If (after an optional `callback` mapping) any item is not a finite number.\n */\nexport function sum<T>(array: T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n return array.reduce<number>((acc, item) => {\n const val = callback ? callback(item) : (item as unknown as number);\n\n if (typeof val !== 'number' || Number.isNaN(val)) {\n throw new TypeError('sum: encountered a non-numeric value; provide a callback to map non-number items');\n }\n\n return acc + val;\n }, 0);\n}\n"],"mappings":";AAiBA,SAAgB,EAAO,GAAY,GAAwC;CAGzE,OAFI,EAAM,WAAW,IAAU,IAExB,EAAM,QAAgB,GAAK,MAAS;EACzC,IAAM,IAAM,IAAW,EAAS,CAAI,IAAK;EAEzC,IAAI,OAAO,KAAQ,YAAY,OAAO,MAAM,CAAG,GAC7C,MAAU,UAAU,kFAAkF;EAGxG,OAAO,IAAM;CACf,GAAG,CAAC;AACN"}
1
+ {"version":3,"file":"sum.js","names":[],"sources":["../../src/math/sum.ts"],"sourcesContent":["/**\n * Sum numbers in an array or numbers mapped by a callback function.\n *\n * @example\n * ```ts\n * sum([1, 2, 3]) // 6\n * sum([{value: 1}, {value: 2}, {value: 3}], (item) => item.value) // 6\n * sum(['apple', 'banana', 'cherry']) // TypeError\n * ```\n *\n * @param array - The array to sum.\n * @param callback - An optional callback function to map the values.\n *\n * @returns The sum of the numbers in the array or the sum of the mapped values.\n *\n * @throws {TypeError} If (after an optional `callback` mapping) any item is not a finite number.\n */\nexport function sum<T>(array: readonly T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n return array.reduce<number>((acc, item) => {\n const val = callback ? callback(item) : (item as unknown as number);\n\n if (!Number.isFinite(val)) {\n throw new TypeError('sum: encountered a non-numeric value; provide a callback to map non-number items');\n }\n\n return acc + val;\n }, 0);\n}\n"],"mappings":"AAiBA,SAAgB,IAAO,EAAqB,EAAwC,CAGlF,OAFI,EAAM,SAAW,EAAU,EAExB,EAAM,QAAgB,EAAK,IAAS,CACzC,IAAM,EAAM,EAAW,EAAS,CAAI,EAAK,EAEzC,GAAI,CAAC,OAAO,SAAS,CAAG,EACtB,MAAU,UAAU,kFAAkF,EAGxG,OAAO,EAAM,CACf,EAAG,CAAC,CACN"}
@@ -1,2 +1,2 @@
1
- const e=require("./average.cjs");function t(t,n){if(t.length===0)return 0;let r=n?t.map(n):t,i=e.average(r)??0;return e.average(r.map(e=>(e-i)**2))??0}exports.variance=t;
1
+ const e=require("./average.cjs");function variance(t,n){if(t.length===0)return 0;let r=n?t.map(n):t,i=e.average(r)??0;return e.average(r.map(e=>(e-i)**2))??0}exports.variance=variance;
2
2
  //# sourceMappingURL=variance.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"variance.cjs","names":[],"sources":["../../src/math/variance.ts"],"sourcesContent":["import { average } from './average';\n\n/**\n * Computes the population variance (average squared deviation from the mean) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * variance([2, 4, 4, 4, 5, 5, 7, 9]); // 4\n * variance([{ n: 1 }, { n: 3 }], (item) => item.n); // 1\n * variance([]); // 0\n * ```\n *\n * @param array - The array to compute variance over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population variance, or `0` for an empty array.\n */\nexport function variance<T>(array: T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n const values = callback ? array.map(callback) : (array as unknown as number[]);\n const mean = average(values) ?? 0;\n\n return average(values.map((value) => (value - mean) ** 2)) ?? 0;\n}\n"],"mappings":"iCAiBA,SAAgB,EAAY,EAAY,EAAwC,CAC9E,GAAI,EAAM,SAAW,EAAG,MAAO,GAE/B,IAAM,EAAS,EAAW,EAAM,IAAI,CAAQ,EAAK,EAC3C,EAAO,EAAA,QAAQ,CAAM,GAAK,EAEhC,OAAO,EAAA,QAAQ,EAAO,IAAK,IAAW,EAAQ,IAAS,CAAC,CAAC,GAAK,CAChE"}
1
+ {"version":3,"file":"variance.cjs","names":[],"sources":["../../src/math/variance.ts"],"sourcesContent":["import { average } from './average';\n\n/**\n * Computes the population variance (average squared deviation from the mean) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * variance([2, 4, 4, 4, 5, 5, 7, 9]); // 4\n * variance([{ n: 1 }, { n: 3 }], (item) => item.n); // 1\n * variance([]); // 0\n * ```\n *\n * @param array - The array to compute variance over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population variance, or `0` for an empty array.\n */\nexport function variance<T>(array: readonly T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n const values = callback ? array.map(callback) : (array as unknown as number[]);\n const mean = average(values) ?? 0;\n\n return average(values.map((value) => (value - mean) ** 2)) ?? 0;\n}\n"],"mappings":"iCAiBA,SAAgB,SAAY,EAAqB,EAAwC,CACvF,GAAI,EAAM,SAAW,EAAG,MAAO,GAE/B,IAAM,EAAS,EAAW,EAAM,IAAI,CAAQ,EAAK,EAC3C,EAAO,EAAA,QAAQ,CAAM,GAAK,EAEhC,OAAO,EAAA,QAAQ,EAAO,IAAK,IAAW,EAAQ,IAAS,CAAC,CAAC,GAAK,CAChE"}
@@ -13,5 +13,5 @@
13
13
  * @param callback - An optional callback to map each item to a number.
14
14
  * @returns The population variance, or `0` for an empty array.
15
15
  */
16
- export declare function variance<T>(array: T[], callback?: (item: T) => number): number;
16
+ export declare function variance<T>(array: readonly T[], callback?: (item: T) => number): number;
17
17
  //# sourceMappingURL=variance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variance.d.ts","sourceRoot":"","sources":["../../src/math/variance.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAO9E"}
1
+ {"version":3,"file":"variance.d.ts","sourceRoot":"","sources":["../../src/math/variance.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAOvF"}
@@ -1,11 +1,2 @@
1
- import { average as e } from "./average.js";
2
- //#region src/math/variance.ts
3
- function t(t, n) {
4
- if (t.length === 0) return 0;
5
- let r = n ? t.map(n) : t, i = e(r) ?? 0;
6
- return e(r.map((e) => (e - i) ** 2)) ?? 0;
7
- }
8
- //#endregion
9
- export { t as variance };
10
-
1
+ import{average as e}from"./average.js";function variance(t,n){if(t.length===0)return 0;let r=n?t.map(n):t,i=e(r)??0;return e(r.map(e=>(e-i)**2))??0}export{variance};
11
2
  //# sourceMappingURL=variance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"variance.js","names":[],"sources":["../../src/math/variance.ts"],"sourcesContent":["import { average } from './average';\n\n/**\n * Computes the population variance (average squared deviation from the mean) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * variance([2, 4, 4, 4, 5, 5, 7, 9]); // 4\n * variance([{ n: 1 }, { n: 3 }], (item) => item.n); // 1\n * variance([]); // 0\n * ```\n *\n * @param array - The array to compute variance over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population variance, or `0` for an empty array.\n */\nexport function variance<T>(array: T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n const values = callback ? array.map(callback) : (array as unknown as number[]);\n const mean = average(values) ?? 0;\n\n return average(values.map((value) => (value - mean) ** 2)) ?? 0;\n}\n"],"mappings":";;AAiBA,SAAgB,EAAY,GAAY,GAAwC;CAC9E,IAAI,EAAM,WAAW,GAAG,OAAO;CAE/B,IAAM,IAAS,IAAW,EAAM,IAAI,CAAQ,IAAK,GAC3C,IAAO,EAAQ,CAAM,KAAK;CAEhC,OAAO,EAAQ,EAAO,KAAK,OAAW,IAAQ,MAAS,CAAC,CAAC,KAAK;AAChE"}
1
+ {"version":3,"file":"variance.js","names":[],"sources":["../../src/math/variance.ts"],"sourcesContent":["import { average } from './average';\n\n/**\n * Computes the population variance (average squared deviation from the mean) of an array of\n * numbers, or of values mapped by a callback.\n *\n * @example\n * ```ts\n * variance([2, 4, 4, 4, 5, 5, 7, 9]); // 4\n * variance([{ n: 1 }, { n: 3 }], (item) => item.n); // 1\n * variance([]); // 0\n * ```\n *\n * @param array - The array to compute variance over.\n * @param callback - An optional callback to map each item to a number.\n * @returns The population variance, or `0` for an empty array.\n */\nexport function variance<T>(array: readonly T[], callback?: (item: T) => number): number {\n if (array.length === 0) return 0;\n\n const values = callback ? array.map(callback) : (array as unknown as number[]);\n const mean = average(values) ?? 0;\n\n return average(values.map((value) => (value - mean) ** 2)) ?? 0;\n}\n"],"mappings":"uCAiBA,SAAgB,SAAY,EAAqB,EAAwC,CACvF,GAAI,EAAM,SAAW,EAAG,MAAO,GAE/B,IAAM,EAAS,EAAW,EAAM,IAAI,CAAQ,EAAK,EAC3C,EAAO,EAAQ,CAAM,GAAK,EAEhC,OAAO,EAAQ,EAAO,IAAK,IAAW,EAAQ,IAAS,CAAC,CAAC,GAAK,CAChE"}
@@ -1,2 +1,2 @@
1
- const e=require("../_common/unsafePaths.cjs"),t=require("../guards/isPlainObject.cjs");function n(n,...r){let i={...n};for(let n of r)if(t.isPlainObject(n))for(let t of Object.keys(n))e.isUnsafeKey(t)||i[t]===void 0&&(i[t]=n[t]);return i}exports.defaults=n;
1
+ const e=require("../_common/unsafePaths.cjs"),t=require("../guards/isPlainObject.cjs");function defaults(n,...r){let i={...n};for(let n of r)if(t.isPlainObject(n))for(let t of Object.keys(n))e.isUnsafeKey(t)||i[t]===void 0&&(i[t]=n[t]);return i}exports.defaults=defaults;
2
2
  //# sourceMappingURL=defaults.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.cjs","names":[],"sources":["../../src/object/defaults.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\n/**\n * Fills in `undefined` properties in `target` with values from `sources`. First source wins\n * — unlike `shallowMerge`, already-set keys are never overwritten.\n *\n * @example\n * ```ts\n * defaults({ a: 1, b: undefined }, { a: 99, b: 2, c: 3 });\n * // { a: 1, b: 2, c: 3 }\n * ```\n *\n * @param target - The object to fill in.\n * @param sources - One or more partial objects supplying default values.\n * @returns A new object with missing keys filled from `sources`.\n */\nexport function defaults<T extends Obj>(target: T, ...sources: Array<Partial<T>>): T {\n const out = { ...target };\n\n for (const source of sources) {\n if (!isPlainObject(source)) continue;\n\n for (const key of Object.keys(source) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (out[key] === undefined) {\n out[key] = source[key] as T[keyof T];\n }\n }\n }\n\n return out;\n}\n"],"mappings":"uFAkBA,SAAgB,EAAwB,EAAW,GAAG,EAA+B,CACnF,IAAM,EAAM,CAAE,GAAG,CAAO,EAExB,IAAK,IAAM,KAAU,EACd,KAAA,cAAc,CAAM,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,EAC9B,EAAA,YAAY,CAAkB,GAE9B,EAAI,KAAS,IAAA,KACf,EAAI,GAAO,EAAO,IAKxB,OAAO,CACT"}
1
+ {"version":3,"file":"defaults.cjs","names":[],"sources":["../../src/object/defaults.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\n/**\n * Fills in `undefined` properties in `target` with values from `sources`. First source wins\n * — unlike `shallowMerge`, already-set keys are never overwritten.\n *\n * @example\n * ```ts\n * defaults({ a: 1, b: undefined }, { a: 99, b: 2, c: 3 });\n * // { a: 1, b: 2, c: 3 }\n * ```\n *\n * @param target - The object to fill in.\n * @param sources - One or more partial objects supplying default values.\n * @returns A new object with missing keys filled from `sources`.\n */\nexport function defaults<T extends Obj>(target: T, ...sources: Array<Partial<T>>): T {\n const out = { ...target };\n\n for (const source of sources) {\n if (!isPlainObject(source)) continue;\n\n for (const key of Object.keys(source) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (out[key] === undefined) {\n out[key] = source[key] as T[keyof T];\n }\n }\n }\n\n return out;\n}\n"],"mappings":"uFAkBA,SAAgB,SAAwB,EAAW,GAAG,EAA+B,CACnF,IAAM,EAAM,CAAE,GAAG,CAAO,EAExB,IAAK,IAAM,KAAU,EACd,KAAA,cAAc,CAAM,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,EAC9B,EAAA,YAAY,CAAkB,GAE9B,EAAI,KAAS,IAAA,KACf,EAAI,GAAO,EAAO,IAKxB,OAAO,CACT"}
@@ -1,12 +1,2 @@
1
- import { isUnsafeKey as e } from "../_common/unsafePaths.js";
2
- import { isPlainObject as t } from "../guards/isPlainObject.js";
3
- //#region src/object/defaults.ts
4
- function n(n, ...r) {
5
- let i = { ...n };
6
- for (let n of r) if (t(n)) for (let t of Object.keys(n)) e(t) || i[t] === void 0 && (i[t] = n[t]);
7
- return i;
8
- }
9
- //#endregion
10
- export { n as defaults };
11
-
1
+ import{isUnsafeKey as e}from"../_common/unsafePaths.js";import{isPlainObject as t}from"../guards/isPlainObject.js";function defaults(n,...r){let i={...n};for(let n of r)if(t(n))for(let t of Object.keys(n))e(t)||i[t]===void 0&&(i[t]=n[t]);return i}export{defaults};
12
2
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","names":[],"sources":["../../src/object/defaults.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\n/**\n * Fills in `undefined` properties in `target` with values from `sources`. First source wins\n * — unlike `shallowMerge`, already-set keys are never overwritten.\n *\n * @example\n * ```ts\n * defaults({ a: 1, b: undefined }, { a: 99, b: 2, c: 3 });\n * // { a: 1, b: 2, c: 3 }\n * ```\n *\n * @param target - The object to fill in.\n * @param sources - One or more partial objects supplying default values.\n * @returns A new object with missing keys filled from `sources`.\n */\nexport function defaults<T extends Obj>(target: T, ...sources: Array<Partial<T>>): T {\n const out = { ...target };\n\n for (const source of sources) {\n if (!isPlainObject(source)) continue;\n\n for (const key of Object.keys(source) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (out[key] === undefined) {\n out[key] = source[key] as T[keyof T];\n }\n }\n }\n\n return out;\n}\n"],"mappings":";;;AAkBA,SAAgB,EAAwB,GAAW,GAAG,GAA+B;CACnF,IAAM,IAAM,EAAE,GAAG,EAAO;CAExB,KAAK,IAAM,KAAU,GACd,MAAc,CAAM,GAEzB,KAAK,IAAM,KAAO,OAAO,KAAK,CAAM,GAC9B,EAAY,CAAkB,KAE9B,EAAI,OAAS,KAAA,MACf,EAAI,KAAO,EAAO;CAKxB,OAAO;AACT"}
1
+ {"version":3,"file":"defaults.js","names":[],"sources":["../../src/object/defaults.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\nimport type { Obj } from '../types';\n\n/**\n * Fills in `undefined` properties in `target` with values from `sources`. First source wins\n * — unlike `shallowMerge`, already-set keys are never overwritten.\n *\n * @example\n * ```ts\n * defaults({ a: 1, b: undefined }, { a: 99, b: 2, c: 3 });\n * // { a: 1, b: 2, c: 3 }\n * ```\n *\n * @param target - The object to fill in.\n * @param sources - One or more partial objects supplying default values.\n * @returns A new object with missing keys filled from `sources`.\n */\nexport function defaults<T extends Obj>(target: T, ...sources: Array<Partial<T>>): T {\n const out = { ...target };\n\n for (const source of sources) {\n if (!isPlainObject(source)) continue;\n\n for (const key of Object.keys(source) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (out[key] === undefined) {\n out[key] = source[key] as T[keyof T];\n }\n }\n }\n\n return out;\n}\n"],"mappings":"mHAkBA,SAAgB,SAAwB,EAAW,GAAG,EAA+B,CACnF,IAAM,EAAM,CAAE,GAAG,CAAO,EAExB,IAAK,IAAM,KAAU,EACd,KAAc,CAAM,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAM,EAC9B,EAAY,CAAkB,GAE9B,EAAI,KAAS,IAAA,KACf,EAAI,GAAO,EAAO,IAKxB,OAAO,CACT"}
@@ -1,2 +1,2 @@
1
- const e=require("../guards/isEqual.cjs"),t=require("../_common/unsafePaths.cjs");function n(n={},r={},i=e.isEqual){let a=[],o=[],s={},c=new Set(Object.keys(n)),l=new Set(Object.keys(r));for(let e of l)c.has(e)?!t.isUnsafeKey(e)&&!i(n[e],r[e])&&(s[e]={after:r[e],before:n[e]}):a.push(e);for(let e of c)l.has(e)||o.push(e);return{added:a,changed:s,removed:o}}function r(t,n,r){let i=r?.compareFn??((t,n)=>e.isEqual(t,n));return{added:n.filter(e=>!t.some(t=>i(t,e))),removed:t.filter(e=>!n.some(t=>i(e,t)))}}exports.diff=n,exports.diffArrays=r;
1
+ const e=require("../guards/isEqual.cjs"),t=require("../_common/unsafePaths.cjs");function diff(n={},r={},i=e.isEqual){let a=[],o=[],s={},c=new Set(Object.keys(n)),l=new Set(Object.keys(r));for(let e of l)c.has(e)?!t.isUnsafeKey(e)&&!i(n[e],r[e])&&(s[e]={after:r[e],before:n[e]}):a.push(e);for(let e of c)l.has(e)||o.push(e);return{added:a,changed:s,removed:o}}function diffArrays(t,n,r){let i=r?.compareFn??((t,n)=>e.isEqual(t,n));return{added:n.filter(e=>!t.some(t=>i(t,e))),removed:t.filter(e=>!n.some(t=>i(e,t)))}}exports.diff=diff,exports.diffArrays=diffArrays;
2
2
  //# sourceMappingURL=diff.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.cjs","names":[],"sources":["../../src/object/diff.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isEqual } from '../guards/isEqual';\nimport type { Obj } from '../types';\n\nexport type DiffResult<T extends Obj> = {\n /** Keys present in `after` but not in `before`. */\n added: Array<keyof T & string>;\n /** Keys present in both objects whose values differ. Maps key → `{ before, after }`. */\n changed: { [K in keyof T]?: { after: T[K]; before: T[K] } };\n /** Keys present in `before` but not in `after`. */\n removed: Array<keyof T & string>;\n};\n\n/**\n * Computes the structural difference between two plain objects.\n * Returns an `{ added, removed, changed }` result — no sentinel symbols needed.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are omitted from `changed`.\n *\n * @example\n * ```ts\n * diff({ a: 1, b: 2, c: 3 }, { a: 1, b: 99 });\n * // { added: [], removed: ['c'], changed: { b: { before: 2, after: 99 } } }\n *\n * diff({ x: { n: 1 } }, { x: { n: 2 } });\n * // { added: [], removed: [], changed: { x: { before: { n: 1 }, after: { n: 2 } } } }\n * ```\n *\n * @param before - The original object.\n * @param after - The updated object.\n * @param compareFn - Custom equality function. Defaults to deep `isEqual`.\n */\nexport function diff<T extends Obj>(\n before: T = {} as T,\n after: T = {} as T,\n compareFn: (a: unknown, b: unknown) => boolean = isEqual,\n): DiffResult<T> {\n const added: Array<keyof T & string> = [];\n const removed: Array<keyof T & string> = [];\n const changed: Record<string, { after: unknown; before: unknown }> = {};\n\n const beforeKeys = new Set(Object.keys(before));\n const afterKeys = new Set(Object.keys(after));\n\n for (const key of afterKeys) {\n if (!beforeKeys.has(key)) {\n added.push(key as keyof T & string);\n } else if (!isUnsafeKey(key) && !compareFn(before[key], after[key])) {\n changed[key] = { after: after[key], before: before[key] };\n }\n }\n\n for (const key of beforeKeys) {\n if (!afterKeys.has(key)) {\n removed.push(key as keyof T & string);\n }\n }\n\n return { added, changed: changed as DiffResult<T>['changed'], removed };\n}\n\nexport type ArrayDiff<T> = {\n added: T[];\n removed: T[];\n};\n\nexport type ArrayDiffOptions<T> = {\n compareFn?: (a: T, b: T) => boolean;\n};\n\n/**\n * Computes the set-difference between two arrays.\n * Items present in `after` but not `before` are `added`.\n * Items present in `before` but not `after` are `removed`.\n * Order-independent; uses deep equality by default.\n *\n * @example\n * ```ts\n * diffArrays([1, 2, 3], [2, 3, 4]); // { added: [4], removed: [1] }\n * diffArrays(\n * [{ id: 1 }, { id: 2 }],\n * [{ id: 2 }, { id: 3 }],\n * { compareFn: (a, b) => a.id === b.id },\n * ); // { added: [{ id: 3 }], removed: [{ id: 1 }] }\n * ```\n *\n * @param before - The original array.\n * @param after - The updated array.\n * @param [options.compareFn] - Custom equality function. Defaults to deep `isEqual`.\n * @returns An object with `added` and `removed` arrays.\n */\nexport function diffArrays<T>(before: T[], after: T[], options?: ArrayDiffOptions<T>): ArrayDiff<T> {\n const compareFn = options?.compareFn ?? ((a: T, b: T) => isEqual(a, b));\n\n return {\n added: after.filter((item) => !before.some((b) => compareFn(b, item))),\n removed: before.filter((item) => !after.some((a) => compareFn(item, a))),\n };\n}\n"],"mappings":"iFA+BA,SAAgB,EACd,EAAY,CAAC,EACb,EAAW,CAAC,EACZ,EAAiD,EAAA,QAClC,CACf,IAAM,EAAiC,CAAC,EAClC,EAAmC,CAAC,EACpC,EAA+D,CAAC,EAEhE,EAAa,IAAI,IAAI,OAAO,KAAK,CAAM,CAAC,EACxC,EAAY,IAAI,IAAI,OAAO,KAAK,CAAK,CAAC,EAE5C,IAAK,IAAM,KAAO,EACX,EAAW,IAAI,CAAG,EAEZ,CAAC,EAAA,YAAY,CAAG,GAAK,CAAC,EAAU,EAAO,GAAM,EAAM,EAAI,IAChE,EAAQ,GAAO,CAAE,MAAO,EAAM,GAAM,OAAQ,EAAO,EAAK,GAFxD,EAAM,KAAK,CAAuB,EAMtC,IAAK,IAAM,KAAO,EACX,EAAU,IAAI,CAAG,GACpB,EAAQ,KAAK,CAAuB,EAIxC,MAAO,CAAE,QAAgB,UAAqC,SAAQ,CACxE,CAgCA,SAAgB,EAAc,EAAa,EAAY,EAA6C,CAClG,IAAM,EAAY,GAAS,aAAe,EAAM,IAAS,EAAA,QAAQ,EAAG,CAAC,GAErE,MAAO,CACL,MAAO,EAAM,OAAQ,GAAS,CAAC,EAAO,KAAM,GAAM,EAAU,EAAG,CAAI,CAAC,CAAC,EACrE,QAAS,EAAO,OAAQ,GAAS,CAAC,EAAM,KAAM,GAAM,EAAU,EAAM,CAAC,CAAC,CAAC,CACzE,CACF"}
1
+ {"version":3,"file":"diff.cjs","names":[],"sources":["../../src/object/diff.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isEqual } from '../guards/isEqual';\nimport type { Obj } from '../types';\n\nexport type DiffResult<T extends Obj> = {\n /** Keys present in `after` but not in `before`. */\n added: Array<keyof T & string>;\n /** Keys present in both objects whose values differ. Maps key → `{ before, after }`. */\n changed: { [K in keyof T]?: { after: T[K]; before: T[K] } };\n /** Keys present in `before` but not in `after`. */\n removed: Array<keyof T & string>;\n};\n\n/**\n * Computes the structural difference between two plain objects.\n * Returns an `{ added, removed, changed }` result — no sentinel symbols needed.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are omitted from `changed`.\n *\n * @example\n * ```ts\n * diff({ a: 1, b: 2, c: 3 }, { a: 1, b: 99 });\n * // { added: [], removed: ['c'], changed: { b: { before: 2, after: 99 } } }\n *\n * diff({ x: { n: 1 } }, { x: { n: 2 } });\n * // { added: [], removed: [], changed: { x: { before: { n: 1 }, after: { n: 2 } } } }\n * ```\n *\n * @param before - The original object.\n * @param after - The updated object.\n * @param compareFn - Custom equality function. Defaults to deep `isEqual`.\n */\nexport function diff<T extends Obj>(\n before: T = {} as T,\n after: T = {} as T,\n compareFn: (a: unknown, b: unknown) => boolean = isEqual,\n): DiffResult<T> {\n const added: Array<keyof T & string> = [];\n const removed: Array<keyof T & string> = [];\n const changed: Record<string, { after: unknown; before: unknown }> = {};\n\n const beforeKeys = new Set(Object.keys(before));\n const afterKeys = new Set(Object.keys(after));\n\n for (const key of afterKeys) {\n if (!beforeKeys.has(key)) {\n added.push(key as keyof T & string);\n } else if (!isUnsafeKey(key) && !compareFn(before[key], after[key])) {\n changed[key] = { after: after[key], before: before[key] };\n }\n }\n\n for (const key of beforeKeys) {\n if (!afterKeys.has(key)) {\n removed.push(key as keyof T & string);\n }\n }\n\n return { added, changed: changed as DiffResult<T>['changed'], removed };\n}\n\nexport type ArrayDiff<T> = {\n added: T[];\n removed: T[];\n};\n\nexport type ArrayDiffOptions<T> = {\n compareFn?: (a: T, b: T) => boolean;\n};\n\n/**\n * Computes the set-difference between two arrays.\n * Items present in `after` but not `before` are `added`.\n * Items present in `before` but not `after` are `removed`.\n * Order-independent; uses deep equality by default.\n *\n * @example\n * ```ts\n * diffArrays([1, 2, 3], [2, 3, 4]); // { added: [4], removed: [1] }\n * diffArrays(\n * [{ id: 1 }, { id: 2 }],\n * [{ id: 2 }, { id: 3 }],\n * { compareFn: (a, b) => a.id === b.id },\n * ); // { added: [{ id: 3 }], removed: [{ id: 1 }] }\n * ```\n *\n * @param before - The original array.\n * @param after - The updated array.\n * @param [options.compareFn] - Custom equality function. Defaults to deep `isEqual`.\n * @returns An object with `added` and `removed` arrays.\n */\nexport function diffArrays<T>(before: readonly T[], after: readonly T[], options?: ArrayDiffOptions<T>): ArrayDiff<T> {\n const compareFn = options?.compareFn ?? ((a: T, b: T) => isEqual(a, b));\n\n return {\n added: after.filter((item) => !before.some((b) => compareFn(b, item))),\n removed: before.filter((item) => !after.some((a) => compareFn(item, a))),\n };\n}\n"],"mappings":"iFA+BA,SAAgB,KACd,EAAY,CAAC,EACb,EAAW,CAAC,EACZ,EAAiD,EAAA,QAClC,CACf,IAAM,EAAiC,CAAC,EAClC,EAAmC,CAAC,EACpC,EAA+D,CAAC,EAEhE,EAAa,IAAI,IAAI,OAAO,KAAK,CAAM,CAAC,EACxC,EAAY,IAAI,IAAI,OAAO,KAAK,CAAK,CAAC,EAE5C,IAAK,IAAM,KAAO,EACX,EAAW,IAAI,CAAG,EAEZ,CAAC,EAAA,YAAY,CAAG,GAAK,CAAC,EAAU,EAAO,GAAM,EAAM,EAAI,IAChE,EAAQ,GAAO,CAAE,MAAO,EAAM,GAAM,OAAQ,EAAO,EAAK,GAFxD,EAAM,KAAK,CAAuB,EAMtC,IAAK,IAAM,KAAO,EACX,EAAU,IAAI,CAAG,GACpB,EAAQ,KAAK,CAAuB,EAIxC,MAAO,CAAE,QAAgB,UAAqC,SAAQ,CACxE,CAgCA,SAAgB,WAAc,EAAsB,EAAqB,EAA6C,CACpH,IAAM,EAAY,GAAS,aAAe,EAAM,IAAS,EAAA,QAAQ,EAAG,CAAC,GAErE,MAAO,CACL,MAAO,EAAM,OAAQ,GAAS,CAAC,EAAO,KAAM,GAAM,EAAU,EAAG,CAAI,CAAC,CAAC,EACrE,QAAS,EAAO,OAAQ,GAAS,CAAC,EAAM,KAAM,GAAM,EAAU,EAAM,CAAC,CAAC,CAAC,CACzE,CACF"}
@@ -59,5 +59,5 @@ export type ArrayDiffOptions<T> = {
59
59
  * @param [options.compareFn] - Custom equality function. Defaults to deep `isEqual`.
60
60
  * @returns An object with `added` and `removed` arrays.
61
61
  */
62
- export declare function diffArrays<T>(before: T[], after: T[], options?: ArrayDiffOptions<T>): ArrayDiff<T>;
62
+ export declare function diffArrays<T>(before: readonly T[], after: readonly T[], options?: ArrayDiffOptions<T>): ArrayDiff<T>;
63
63
  //# sourceMappingURL=diff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/object/diff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI;IACtC,mDAAmD;IACnD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;IAC/B,wFAAwF;IACxF,OAAO,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;SAAE;KAAE,CAAC;IAC5D,mDAAmD;IACnD,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAChC,MAAM,GAAE,CAAW,EACnB,KAAK,GAAE,CAAW,EAClB,SAAS,GAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAiB,GACvD,UAAU,CAAC,CAAC,CAAC,CAuBf;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,EAAE,CAAC,EAAE,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAOlG"}
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/object/diff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI;IACtC,mDAAmD;IACnD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;IAC/B,wFAAwF;IACxF,OAAO,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;SAAE;KAAE,CAAC;IAC5D,mDAAmD;IACnD,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,GAAG,EAChC,MAAM,GAAE,CAAW,EACnB,KAAK,GAAE,CAAW,EAClB,SAAS,GAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAiB,GACvD,UAAU,CAAC,CAAC,CAAC,CAuBf;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,EAAE,CAAC,EAAE,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAOpH"}
@@ -1,27 +1,2 @@
1
- import { isEqual as e } from "../guards/isEqual.js";
2
- import { isUnsafeKey as t } from "../_common/unsafePaths.js";
3
- //#region src/object/diff.ts
4
- function n(n = {}, r = {}, i = e) {
5
- let a = [], o = [], s = {}, c = new Set(Object.keys(n)), l = new Set(Object.keys(r));
6
- for (let e of l) c.has(e) ? !t(e) && !i(n[e], r[e]) && (s[e] = {
7
- after: r[e],
8
- before: n[e]
9
- }) : a.push(e);
10
- for (let e of c) l.has(e) || o.push(e);
11
- return {
12
- added: a,
13
- changed: s,
14
- removed: o
15
- };
16
- }
17
- function r(t, n, r) {
18
- let i = r?.compareFn ?? ((t, n) => e(t, n));
19
- return {
20
- added: n.filter((e) => !t.some((t) => i(t, e))),
21
- removed: t.filter((e) => !n.some((t) => i(e, t)))
22
- };
23
- }
24
- //#endregion
25
- export { n as diff, r as diffArrays };
26
-
1
+ import{isEqual as e}from"../guards/isEqual.js";import{isUnsafeKey as t}from"../_common/unsafePaths.js";function diff(n={},r={},i=e){let a=[],o=[],s={},c=new Set(Object.keys(n)),l=new Set(Object.keys(r));for(let e of l)c.has(e)?!t(e)&&!i(n[e],r[e])&&(s[e]={after:r[e],before:n[e]}):a.push(e);for(let e of c)l.has(e)||o.push(e);return{added:a,changed:s,removed:o}}function diffArrays(t,n,r){let i=r?.compareFn??((t,n)=>e(t,n));return{added:n.filter(e=>!t.some(t=>i(t,e))),removed:t.filter(e=>!n.some(t=>i(e,t)))}}export{diff,diffArrays};
27
2
  //# sourceMappingURL=diff.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.js","names":[],"sources":["../../src/object/diff.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isEqual } from '../guards/isEqual';\nimport type { Obj } from '../types';\n\nexport type DiffResult<T extends Obj> = {\n /** Keys present in `after` but not in `before`. */\n added: Array<keyof T & string>;\n /** Keys present in both objects whose values differ. Maps key → `{ before, after }`. */\n changed: { [K in keyof T]?: { after: T[K]; before: T[K] } };\n /** Keys present in `before` but not in `after`. */\n removed: Array<keyof T & string>;\n};\n\n/**\n * Computes the structural difference between two plain objects.\n * Returns an `{ added, removed, changed }` result — no sentinel symbols needed.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are omitted from `changed`.\n *\n * @example\n * ```ts\n * diff({ a: 1, b: 2, c: 3 }, { a: 1, b: 99 });\n * // { added: [], removed: ['c'], changed: { b: { before: 2, after: 99 } } }\n *\n * diff({ x: { n: 1 } }, { x: { n: 2 } });\n * // { added: [], removed: [], changed: { x: { before: { n: 1 }, after: { n: 2 } } } }\n * ```\n *\n * @param before - The original object.\n * @param after - The updated object.\n * @param compareFn - Custom equality function. Defaults to deep `isEqual`.\n */\nexport function diff<T extends Obj>(\n before: T = {} as T,\n after: T = {} as T,\n compareFn: (a: unknown, b: unknown) => boolean = isEqual,\n): DiffResult<T> {\n const added: Array<keyof T & string> = [];\n const removed: Array<keyof T & string> = [];\n const changed: Record<string, { after: unknown; before: unknown }> = {};\n\n const beforeKeys = new Set(Object.keys(before));\n const afterKeys = new Set(Object.keys(after));\n\n for (const key of afterKeys) {\n if (!beforeKeys.has(key)) {\n added.push(key as keyof T & string);\n } else if (!isUnsafeKey(key) && !compareFn(before[key], after[key])) {\n changed[key] = { after: after[key], before: before[key] };\n }\n }\n\n for (const key of beforeKeys) {\n if (!afterKeys.has(key)) {\n removed.push(key as keyof T & string);\n }\n }\n\n return { added, changed: changed as DiffResult<T>['changed'], removed };\n}\n\nexport type ArrayDiff<T> = {\n added: T[];\n removed: T[];\n};\n\nexport type ArrayDiffOptions<T> = {\n compareFn?: (a: T, b: T) => boolean;\n};\n\n/**\n * Computes the set-difference between two arrays.\n * Items present in `after` but not `before` are `added`.\n * Items present in `before` but not `after` are `removed`.\n * Order-independent; uses deep equality by default.\n *\n * @example\n * ```ts\n * diffArrays([1, 2, 3], [2, 3, 4]); // { added: [4], removed: [1] }\n * diffArrays(\n * [{ id: 1 }, { id: 2 }],\n * [{ id: 2 }, { id: 3 }],\n * { compareFn: (a, b) => a.id === b.id },\n * ); // { added: [{ id: 3 }], removed: [{ id: 1 }] }\n * ```\n *\n * @param before - The original array.\n * @param after - The updated array.\n * @param [options.compareFn] - Custom equality function. Defaults to deep `isEqual`.\n * @returns An object with `added` and `removed` arrays.\n */\nexport function diffArrays<T>(before: T[], after: T[], options?: ArrayDiffOptions<T>): ArrayDiff<T> {\n const compareFn = options?.compareFn ?? ((a: T, b: T) => isEqual(a, b));\n\n return {\n added: after.filter((item) => !before.some((b) => compareFn(b, item))),\n removed: before.filter((item) => !after.some((a) => compareFn(item, a))),\n };\n}\n"],"mappings":";;;AA+BA,SAAgB,EACd,IAAY,CAAC,GACb,IAAW,CAAC,GACZ,IAAiD,GAClC;CACf,IAAM,IAAiC,CAAC,GAClC,IAAmC,CAAC,GACpC,IAA+D,CAAC,GAEhE,IAAa,IAAI,IAAI,OAAO,KAAK,CAAM,CAAC,GACxC,IAAY,IAAI,IAAI,OAAO,KAAK,CAAK,CAAC;CAE5C,KAAK,IAAM,KAAO,GAChB,AAAK,EAAW,IAAI,CAAG,IAEZ,CAAC,EAAY,CAAG,KAAK,CAAC,EAAU,EAAO,IAAM,EAAM,EAAI,MAChE,EAAQ,KAAO;EAAE,OAAO,EAAM;EAAM,QAAQ,EAAO;CAAK,KAFxD,EAAM,KAAK,CAAuB;CAMtC,KAAK,IAAM,KAAO,GAChB,AAAK,EAAU,IAAI,CAAG,KACpB,EAAQ,KAAK,CAAuB;CAIxC,OAAO;EAAE;EAAgB;EAAqC;CAAQ;AACxE;AAgCA,SAAgB,EAAc,GAAa,GAAY,GAA6C;CAClG,IAAM,IAAY,GAAS,eAAe,GAAM,MAAS,EAAQ,GAAG,CAAC;CAErE,OAAO;EACL,OAAO,EAAM,QAAQ,MAAS,CAAC,EAAO,MAAM,MAAM,EAAU,GAAG,CAAI,CAAC,CAAC;EACrE,SAAS,EAAO,QAAQ,MAAS,CAAC,EAAM,MAAM,MAAM,EAAU,GAAM,CAAC,CAAC,CAAC;CACzE;AACF"}
1
+ {"version":3,"file":"diff.js","names":[],"sources":["../../src/object/diff.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport { isEqual } from '../guards/isEqual';\nimport type { Obj } from '../types';\n\nexport type DiffResult<T extends Obj> = {\n /** Keys present in `after` but not in `before`. */\n added: Array<keyof T & string>;\n /** Keys present in both objects whose values differ. Maps key → `{ before, after }`. */\n changed: { [K in keyof T]?: { after: T[K]; before: T[K] } };\n /** Keys present in `before` but not in `after`. */\n removed: Array<keyof T & string>;\n};\n\n/**\n * Computes the structural difference between two plain objects.\n * Returns an `{ added, removed, changed }` result — no sentinel symbols needed.\n * Dangerous keys (`__proto__`, `constructor`, `prototype`) are omitted from `changed`.\n *\n * @example\n * ```ts\n * diff({ a: 1, b: 2, c: 3 }, { a: 1, b: 99 });\n * // { added: [], removed: ['c'], changed: { b: { before: 2, after: 99 } } }\n *\n * diff({ x: { n: 1 } }, { x: { n: 2 } });\n * // { added: [], removed: [], changed: { x: { before: { n: 1 }, after: { n: 2 } } } }\n * ```\n *\n * @param before - The original object.\n * @param after - The updated object.\n * @param compareFn - Custom equality function. Defaults to deep `isEqual`.\n */\nexport function diff<T extends Obj>(\n before: T = {} as T,\n after: T = {} as T,\n compareFn: (a: unknown, b: unknown) => boolean = isEqual,\n): DiffResult<T> {\n const added: Array<keyof T & string> = [];\n const removed: Array<keyof T & string> = [];\n const changed: Record<string, { after: unknown; before: unknown }> = {};\n\n const beforeKeys = new Set(Object.keys(before));\n const afterKeys = new Set(Object.keys(after));\n\n for (const key of afterKeys) {\n if (!beforeKeys.has(key)) {\n added.push(key as keyof T & string);\n } else if (!isUnsafeKey(key) && !compareFn(before[key], after[key])) {\n changed[key] = { after: after[key], before: before[key] };\n }\n }\n\n for (const key of beforeKeys) {\n if (!afterKeys.has(key)) {\n removed.push(key as keyof T & string);\n }\n }\n\n return { added, changed: changed as DiffResult<T>['changed'], removed };\n}\n\nexport type ArrayDiff<T> = {\n added: T[];\n removed: T[];\n};\n\nexport type ArrayDiffOptions<T> = {\n compareFn?: (a: T, b: T) => boolean;\n};\n\n/**\n * Computes the set-difference between two arrays.\n * Items present in `after` but not `before` are `added`.\n * Items present in `before` but not `after` are `removed`.\n * Order-independent; uses deep equality by default.\n *\n * @example\n * ```ts\n * diffArrays([1, 2, 3], [2, 3, 4]); // { added: [4], removed: [1] }\n * diffArrays(\n * [{ id: 1 }, { id: 2 }],\n * [{ id: 2 }, { id: 3 }],\n * { compareFn: (a, b) => a.id === b.id },\n * ); // { added: [{ id: 3 }], removed: [{ id: 1 }] }\n * ```\n *\n * @param before - The original array.\n * @param after - The updated array.\n * @param [options.compareFn] - Custom equality function. Defaults to deep `isEqual`.\n * @returns An object with `added` and `removed` arrays.\n */\nexport function diffArrays<T>(before: readonly T[], after: readonly T[], options?: ArrayDiffOptions<T>): ArrayDiff<T> {\n const compareFn = options?.compareFn ?? ((a: T, b: T) => isEqual(a, b));\n\n return {\n added: after.filter((item) => !before.some((b) => compareFn(b, item))),\n removed: before.filter((item) => !after.some((a) => compareFn(item, a))),\n };\n}\n"],"mappings":"uGA+BA,SAAgB,KACd,EAAY,CAAC,EACb,EAAW,CAAC,EACZ,EAAiD,EAClC,CACf,IAAM,EAAiC,CAAC,EAClC,EAAmC,CAAC,EACpC,EAA+D,CAAC,EAEhE,EAAa,IAAI,IAAI,OAAO,KAAK,CAAM,CAAC,EACxC,EAAY,IAAI,IAAI,OAAO,KAAK,CAAK,CAAC,EAE5C,IAAK,IAAM,KAAO,EACX,EAAW,IAAI,CAAG,EAEZ,CAAC,EAAY,CAAG,GAAK,CAAC,EAAU,EAAO,GAAM,EAAM,EAAI,IAChE,EAAQ,GAAO,CAAE,MAAO,EAAM,GAAM,OAAQ,EAAO,EAAK,GAFxD,EAAM,KAAK,CAAuB,EAMtC,IAAK,IAAM,KAAO,EACX,EAAU,IAAI,CAAG,GACpB,EAAQ,KAAK,CAAuB,EAIxC,MAAO,CAAE,QAAgB,UAAqC,SAAQ,CACxE,CAgCA,SAAgB,WAAc,EAAsB,EAAqB,EAA6C,CACpH,IAAM,EAAY,GAAS,aAAe,EAAM,IAAS,EAAQ,EAAG,CAAC,GAErE,MAAO,CACL,MAAO,EAAM,OAAQ,GAAS,CAAC,EAAO,KAAM,GAAM,EAAU,EAAG,CAAI,CAAC,CAAC,EACrE,QAAS,EAAO,OAAQ,GAAS,CAAC,EAAM,KAAM,GAAM,EAAU,EAAM,CAAC,CAAC,CAAC,CACzE,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require("../_common/unsafePaths.cjs");function t(t,n){let r={};for(let i of Object.keys(t))e.isUnsafeKey(i)||n(t[i],i,t)&&(r[i]=t[i]);return r}exports.filterValues=t;
1
+ const e=require("../_common/unsafePaths.cjs");function filterValues(t,n){let r={};for(let i of Object.keys(t))e.isUnsafeKey(i)||n(t[i],i,t)&&(r[i]=t[i]);return r}exports.filterValues=filterValues;
2
2
  //# sourceMappingURL=filterValues.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterValues.cjs","names":[],"sources":["../../src/object/filterValues.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Filters object entries using a value predicate. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * filterValues({ a: 1, b: 2, c: 3 }, (value) => value > 1); // { b: 2, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param predicate - Returns `true` to keep an entry.\n * @returns A new object containing only entries for which `predicate` returned `true`.\n */\nexport function filterValues<T extends Obj>(\n obj: T,\n predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean,\n): Partial<T> {\n const out: Partial<T> = {};\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (predicate(obj[key], key, obj)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAgBA,SAAgB,EACd,EACA,EACY,CACZ,IAAM,EAAkB,CAAC,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAA,YAAY,CAAkB,GAE9B,EAAU,EAAI,GAAM,EAAK,CAAG,IAC9B,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
1
+ {"version":3,"file":"filterValues.cjs","names":[],"sources":["../../src/object/filterValues.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Filters object entries using a value predicate. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * filterValues({ a: 1, b: 2, c: 3 }, (value) => value > 1); // { b: 2, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param predicate - Returns `true` to keep an entry.\n * @returns A new object containing only entries for which `predicate` returned `true`.\n */\nexport function filterValues<T extends Obj>(\n obj: T,\n predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean,\n): Partial<T> {\n const out: Partial<T> = {};\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (predicate(obj[key], key, obj)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"8CAgBA,SAAgB,aACd,EACA,EACY,CACZ,IAAM,EAAkB,CAAC,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAA,YAAY,CAAkB,GAE9B,EAAU,EAAI,GAAM,EAAK,CAAG,IAC9B,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
@@ -1,11 +1,2 @@
1
- import { isUnsafeKey as e } from "../_common/unsafePaths.js";
2
- //#region src/object/filterValues.ts
3
- function t(t, n) {
4
- let r = {};
5
- for (let i of Object.keys(t)) e(i) || n(t[i], i, t) && (r[i] = t[i]);
6
- return r;
7
- }
8
- //#endregion
9
- export { t as filterValues };
10
-
1
+ import{isUnsafeKey as e}from"../_common/unsafePaths.js";function filterValues(t,n){let r={};for(let i of Object.keys(t))e(i)||n(t[i],i,t)&&(r[i]=t[i]);return r}export{filterValues};
11
2
  //# sourceMappingURL=filterValues.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterValues.js","names":[],"sources":["../../src/object/filterValues.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Filters object entries using a value predicate. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * filterValues({ a: 1, b: 2, c: 3 }, (value) => value > 1); // { b: 2, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param predicate - Returns `true` to keep an entry.\n * @returns A new object containing only entries for which `predicate` returned `true`.\n */\nexport function filterValues<T extends Obj>(\n obj: T,\n predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean,\n): Partial<T> {\n const out: Partial<T> = {};\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (predicate(obj[key], key, obj)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":";;AAgBA,SAAgB,EACd,GACA,GACY;CACZ,IAAM,IAAkB,CAAC;CAEzB,KAAK,IAAM,KAAO,OAAO,KAAK,CAAG,GAC3B,EAAY,CAAkB,KAE9B,EAAU,EAAI,IAAM,GAAK,CAAG,MAC9B,EAAI,KAAO,EAAI;CAInB,OAAO;AACT"}
1
+ {"version":3,"file":"filterValues.js","names":[],"sources":["../../src/object/filterValues.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Filters object entries using a value predicate. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * filterValues({ a: 1, b: 2, c: 3 }, (value) => value > 1); // { b: 2, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param predicate - Returns `true` to keep an entry.\n * @returns A new object containing only entries for which `predicate` returned `true`.\n */\nexport function filterValues<T extends Obj>(\n obj: T,\n predicate: (value: T[keyof T], key: keyof T, obj: T) => boolean,\n): Partial<T> {\n const out: Partial<T> = {};\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (predicate(obj[key], key, obj)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n"],"mappings":"wDAgBA,SAAgB,aACd,EACA,EACY,CACZ,IAAM,EAAkB,CAAC,EAEzB,IAAK,IAAM,KAAO,OAAO,KAAK,CAAG,EAC3B,EAAY,CAAkB,GAE9B,EAAU,EAAI,GAAM,EAAK,CAAG,IAC9B,EAAI,GAAO,EAAI,IAInB,OAAO,CACT"}
@@ -1,2 +1,2 @@
1
- const e=require("../_common/unsafePaths.cjs"),t=require("../guards/isPlainObject.cjs");var n=10;function r(i,a,o){let s={};for(let[c,l]of Object.entries(i)){if(e.UNSAFE_PATH_SEGMENTS.has(c))continue;let i=a?`${a}.${c}`:c;t.isPlainObject(l)&&o<n?Object.assign(s,r(l,i,o+1)):s[i]=l}return s}function i(e){return r(e,``,0)}function a(n){let r={};for(let[i,a]of Object.entries(n)){let n=i.split(`.`);if(n.some(t=>e.UNSAFE_PATH_SEGMENTS.has(t)))continue;let o=r;for(let e=0;e<n.length-1;e++)t.isPlainObject(o[n[e]])||(o[n[e]]={}),o=o[n[e]];o[n[n.length-1]]=a}return r}exports.flattenPaths=i,exports.unflattenPaths=a;
1
+ const e=require("../_common/unsafePaths.cjs"),t=require("../guards/isPlainObject.cjs");var n=10;function _flattenPaths(r,i,a){let o={};for(let[s,c]of Object.entries(r)){if(e.UNSAFE_PATH_SEGMENTS.has(s))continue;let r=i?`${i}.${s}`:s;t.isPlainObject(c)&&a<n?Object.assign(o,_flattenPaths(c,r,a+1)):o[r]=c}return o}function flattenPaths(e){return _flattenPaths(e,``,0)}function unflattenPaths(n){let r={};for(let[i,a]of Object.entries(n)){let n=i.split(`.`);if(n.some(t=>e.UNSAFE_PATH_SEGMENTS.has(t)))continue;let o=r;for(let e=0;e<n.length-1;e++)t.isPlainObject(o[n[e]])||(o[n[e]]={}),o=o[n[e]];o[n[n.length-1]]=a}return r}exports.flattenPaths=flattenPaths,exports.unflattenPaths=unflattenPaths;
2
2
  //# sourceMappingURL=flattenPaths.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"flattenPaths.cjs","names":[],"sources":["../../src/object/flattenPaths.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Flattens a nested plain object into a map of dot-notation path keys to leaf values.\n * Keys containing unsafe segments (`__proto__`, `constructor`, `prototype`) are silently skipped.\n * Nesting beyond MAX_FLATTEN_DEPTH is treated as an opaque leaf value to prevent stack overflows.\n *\n * @example\n * ```ts\n * flattenPaths({ a: { b: 1, c: 2 }, d: 3 })\n * // { 'a.b': 1, 'a.c': 2, 'd': 3 }\n * ```\n */\nconst MAX_FLATTEN_DEPTH = 10;\n\nfunction _flattenPaths(obj: Record<string, unknown>, prefix: string, depth: number): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(obj)) {\n if (UNSAFE_PATH_SEGMENTS.has(key)) continue;\n\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(val) && depth < MAX_FLATTEN_DEPTH) {\n Object.assign(result, _flattenPaths(val as Record<string, unknown>, fullKey, depth + 1));\n } else {\n result[fullKey] = val;\n }\n }\n\n return result;\n}\n\nexport function flattenPaths(obj: Record<string, unknown>): Record<string, unknown> {\n return _flattenPaths(obj, '', 0);\n}\n\n/**\n * Reconstructs a nested plain object from a map of dot-notation path keys to leaf values.\n * Any path containing an unsafe segment is silently skipped.\n *\n * @example\n * ```ts\n * unflattenPaths({ 'a.b': 1, 'a.c': 2, 'd': 3 })\n * // { a: { b: 1, c: 2 }, d: 3 }\n * ```\n */\nexport function unflattenPaths(flat: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(flat)) {\n const parts = key.split('.');\n\n if (parts.some((p) => UNSAFE_PATH_SEGMENTS.has(p))) continue;\n\n let obj = result;\n\n for (let i = 0; i < parts.length - 1; i++) {\n if (!isPlainObject(obj[parts[i]])) {\n obj[parts[i]] = {};\n }\n\n obj = obj[parts[i]] as Record<string, unknown>;\n }\n\n obj[parts[parts.length - 1]] = val;\n }\n\n return result;\n}\n"],"mappings":"uFAcA,IAAM,EAAoB,GAE1B,SAAS,EAAc,EAA8B,EAAgB,EAAwC,CAC3G,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAG,EAAG,CAC5C,GAAI,EAAA,qBAAqB,IAAI,CAAG,EAAG,SAEnC,IAAM,EAAU,EAAS,GAAG,EAAO,GAAG,IAAQ,EAE1C,EAAA,cAAc,CAAG,GAAK,EAAQ,EAChC,OAAO,OAAO,EAAQ,EAAc,EAAgC,EAAS,EAAQ,CAAC,CAAC,EAEvF,EAAO,GAAW,CAEtB,CAEA,OAAO,CACT,CAEA,SAAgB,EAAa,EAAuD,CAClF,OAAO,EAAc,EAAK,GAAI,CAAC,CACjC,CAYA,SAAgB,EAAe,EAAwD,CACrF,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAI,EAAG,CAC7C,IAAM,EAAQ,EAAI,MAAM,GAAG,EAE3B,GAAI,EAAM,KAAM,GAAM,EAAA,qBAAqB,IAAI,CAAC,CAAC,EAAG,SAEpD,IAAI,EAAM,EAEV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAS,EAAG,IAC/B,EAAA,cAAc,EAAI,EAAM,GAAG,IAC9B,EAAI,EAAM,IAAM,CAAC,GAGnB,EAAM,EAAI,EAAM,IAGlB,EAAI,EAAM,EAAM,OAAS,IAAM,CACjC,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"flattenPaths.cjs","names":[],"sources":["../../src/object/flattenPaths.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Flattens a nested plain object into a map of dot-notation path keys to leaf values.\n * Keys containing unsafe segments (`__proto__`, `constructor`, `prototype`) are silently skipped.\n * Nesting beyond MAX_FLATTEN_DEPTH is treated as an opaque leaf value to prevent stack overflows.\n *\n * @example\n * ```ts\n * flattenPaths({ a: { b: 1, c: 2 }, d: 3 })\n * // { 'a.b': 1, 'a.c': 2, 'd': 3 }\n * ```\n */\nconst MAX_FLATTEN_DEPTH = 10;\n\nfunction _flattenPaths(obj: Record<string, unknown>, prefix: string, depth: number): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(obj)) {\n if (UNSAFE_PATH_SEGMENTS.has(key)) continue;\n\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(val) && depth < MAX_FLATTEN_DEPTH) {\n Object.assign(result, _flattenPaths(val as Record<string, unknown>, fullKey, depth + 1));\n } else {\n result[fullKey] = val;\n }\n }\n\n return result;\n}\n\nexport function flattenPaths(obj: Record<string, unknown>): Record<string, unknown> {\n return _flattenPaths(obj, '', 0);\n}\n\n/**\n * Reconstructs a nested plain object from a map of dot-notation path keys to leaf values.\n * Any path containing an unsafe segment is silently skipped.\n *\n * @example\n * ```ts\n * unflattenPaths({ 'a.b': 1, 'a.c': 2, 'd': 3 })\n * // { a: { b: 1, c: 2 }, d: 3 }\n * ```\n */\nexport function unflattenPaths(flat: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(flat)) {\n const parts = key.split('.');\n\n if (parts.some((p) => UNSAFE_PATH_SEGMENTS.has(p))) continue;\n\n let obj = result;\n\n for (let i = 0; i < parts.length - 1; i++) {\n if (!isPlainObject(obj[parts[i]])) {\n obj[parts[i]] = {};\n }\n\n obj = obj[parts[i]] as Record<string, unknown>;\n }\n\n obj[parts[parts.length - 1]] = val;\n }\n\n return result;\n}\n"],"mappings":"uFAcA,IAAM,EAAoB,GAE1B,SAAS,cAAc,EAA8B,EAAgB,EAAwC,CAC3G,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAG,EAAG,CAC5C,GAAI,EAAA,qBAAqB,IAAI,CAAG,EAAG,SAEnC,IAAM,EAAU,EAAS,GAAG,EAAO,GAAG,IAAQ,EAE1C,EAAA,cAAc,CAAG,GAAK,EAAQ,EAChC,OAAO,OAAO,EAAQ,cAAc,EAAgC,EAAS,EAAQ,CAAC,CAAC,EAEvF,EAAO,GAAW,CAEtB,CAEA,OAAO,CACT,CAEA,SAAgB,aAAa,EAAuD,CAClF,OAAO,cAAc,EAAK,GAAI,CAAC,CACjC,CAYA,SAAgB,eAAe,EAAwD,CACrF,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAI,EAAG,CAC7C,IAAM,EAAQ,EAAI,MAAM,GAAG,EAE3B,GAAI,EAAM,KAAM,GAAM,EAAA,qBAAqB,IAAI,CAAC,CAAC,EAAG,SAEpD,IAAI,EAAM,EAEV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAS,EAAG,IAC/B,EAAA,cAAc,EAAI,EAAM,GAAG,IAC9B,EAAI,EAAM,IAAM,CAAC,GAGnB,EAAM,EAAI,EAAM,IAGlB,EAAI,EAAM,EAAM,OAAS,IAAM,CACjC,CAEA,OAAO,CACT"}
@@ -1,31 +1,2 @@
1
- import { UNSAFE_PATH_SEGMENTS as e } from "../_common/unsafePaths.js";
2
- import { isPlainObject as t } from "../guards/isPlainObject.js";
3
- //#region src/object/flattenPaths.ts
4
- var n = 10;
5
- function r(i, a, o) {
6
- let s = {};
7
- for (let [c, l] of Object.entries(i)) {
8
- if (e.has(c)) continue;
9
- let i = a ? `${a}.${c}` : c;
10
- t(l) && o < n ? Object.assign(s, r(l, i, o + 1)) : s[i] = l;
11
- }
12
- return s;
13
- }
14
- function i(e) {
15
- return r(e, "", 0);
16
- }
17
- function a(n) {
18
- let r = {};
19
- for (let [i, a] of Object.entries(n)) {
20
- let n = i.split(".");
21
- if (n.some((t) => e.has(t))) continue;
22
- let o = r;
23
- for (let e = 0; e < n.length - 1; e++) t(o[n[e]]) || (o[n[e]] = {}), o = o[n[e]];
24
- o[n[n.length - 1]] = a;
25
- }
26
- return r;
27
- }
28
- //#endregion
29
- export { i as flattenPaths, a as unflattenPaths };
30
-
1
+ import{UNSAFE_PATH_SEGMENTS as e}from"../_common/unsafePaths.js";import{isPlainObject as t}from"../guards/isPlainObject.js";var n=10;function _flattenPaths(r,i,a){let o={};for(let[s,c]of Object.entries(r)){if(e.has(s))continue;let r=i?`${i}.${s}`:s;t(c)&&a<n?Object.assign(o,_flattenPaths(c,r,a+1)):o[r]=c}return o}function flattenPaths(e){return _flattenPaths(e,``,0)}function unflattenPaths(n){let r={};for(let[i,a]of Object.entries(n)){let n=i.split(`.`);if(n.some(t=>e.has(t)))continue;let o=r;for(let e=0;e<n.length-1;e++)t(o[n[e]])||(o[n[e]]={}),o=o[n[e]];o[n[n.length-1]]=a}return r}export{flattenPaths,unflattenPaths};
31
2
  //# sourceMappingURL=flattenPaths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flattenPaths.js","names":[],"sources":["../../src/object/flattenPaths.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Flattens a nested plain object into a map of dot-notation path keys to leaf values.\n * Keys containing unsafe segments (`__proto__`, `constructor`, `prototype`) are silently skipped.\n * Nesting beyond MAX_FLATTEN_DEPTH is treated as an opaque leaf value to prevent stack overflows.\n *\n * @example\n * ```ts\n * flattenPaths({ a: { b: 1, c: 2 }, d: 3 })\n * // { 'a.b': 1, 'a.c': 2, 'd': 3 }\n * ```\n */\nconst MAX_FLATTEN_DEPTH = 10;\n\nfunction _flattenPaths(obj: Record<string, unknown>, prefix: string, depth: number): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(obj)) {\n if (UNSAFE_PATH_SEGMENTS.has(key)) continue;\n\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(val) && depth < MAX_FLATTEN_DEPTH) {\n Object.assign(result, _flattenPaths(val as Record<string, unknown>, fullKey, depth + 1));\n } else {\n result[fullKey] = val;\n }\n }\n\n return result;\n}\n\nexport function flattenPaths(obj: Record<string, unknown>): Record<string, unknown> {\n return _flattenPaths(obj, '', 0);\n}\n\n/**\n * Reconstructs a nested plain object from a map of dot-notation path keys to leaf values.\n * Any path containing an unsafe segment is silently skipped.\n *\n * @example\n * ```ts\n * unflattenPaths({ 'a.b': 1, 'a.c': 2, 'd': 3 })\n * // { a: { b: 1, c: 2 }, d: 3 }\n * ```\n */\nexport function unflattenPaths(flat: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(flat)) {\n const parts = key.split('.');\n\n if (parts.some((p) => UNSAFE_PATH_SEGMENTS.has(p))) continue;\n\n let obj = result;\n\n for (let i = 0; i < parts.length - 1; i++) {\n if (!isPlainObject(obj[parts[i]])) {\n obj[parts[i]] = {};\n }\n\n obj = obj[parts[i]] as Record<string, unknown>;\n }\n\n obj[parts[parts.length - 1]] = val;\n }\n\n return result;\n}\n"],"mappings":";;;AAcA,IAAM,IAAoB;AAE1B,SAAS,EAAc,GAA8B,GAAgB,GAAwC;CAC3G,IAAM,IAAkC,CAAC;CAEzC,KAAK,IAAM,CAAC,GAAK,MAAQ,OAAO,QAAQ,CAAG,GAAG;EAC5C,IAAI,EAAqB,IAAI,CAAG,GAAG;EAEnC,IAAM,IAAU,IAAS,GAAG,EAAO,GAAG,MAAQ;EAE9C,AAAI,EAAc,CAAG,KAAK,IAAQ,IAChC,OAAO,OAAO,GAAQ,EAAc,GAAgC,GAAS,IAAQ,CAAC,CAAC,IAEvF,EAAO,KAAW;CAEtB;CAEA,OAAO;AACT;AAEA,SAAgB,EAAa,GAAuD;CAClF,OAAO,EAAc,GAAK,IAAI,CAAC;AACjC;AAYA,SAAgB,EAAe,GAAwD;CACrF,IAAM,IAAkC,CAAC;CAEzC,KAAK,IAAM,CAAC,GAAK,MAAQ,OAAO,QAAQ,CAAI,GAAG;EAC7C,IAAM,IAAQ,EAAI,MAAM,GAAG;EAE3B,IAAI,EAAM,MAAM,MAAM,EAAqB,IAAI,CAAC,CAAC,GAAG;EAEpD,IAAI,IAAM;EAEV,KAAK,IAAI,IAAI,GAAG,IAAI,EAAM,SAAS,GAAG,KAKpC,AAJK,EAAc,EAAI,EAAM,GAAG,MAC9B,EAAI,EAAM,MAAM,CAAC,IAGnB,IAAM,EAAI,EAAM;EAGlB,EAAI,EAAM,EAAM,SAAS,MAAM;CACjC;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"flattenPaths.js","names":[],"sources":["../../src/object/flattenPaths.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport { isPlainObject } from '../guards/isPlainObject';\n\n/**\n * Flattens a nested plain object into a map of dot-notation path keys to leaf values.\n * Keys containing unsafe segments (`__proto__`, `constructor`, `prototype`) are silently skipped.\n * Nesting beyond MAX_FLATTEN_DEPTH is treated as an opaque leaf value to prevent stack overflows.\n *\n * @example\n * ```ts\n * flattenPaths({ a: { b: 1, c: 2 }, d: 3 })\n * // { 'a.b': 1, 'a.c': 2, 'd': 3 }\n * ```\n */\nconst MAX_FLATTEN_DEPTH = 10;\n\nfunction _flattenPaths(obj: Record<string, unknown>, prefix: string, depth: number): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(obj)) {\n if (UNSAFE_PATH_SEGMENTS.has(key)) continue;\n\n const fullKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(val) && depth < MAX_FLATTEN_DEPTH) {\n Object.assign(result, _flattenPaths(val as Record<string, unknown>, fullKey, depth + 1));\n } else {\n result[fullKey] = val;\n }\n }\n\n return result;\n}\n\nexport function flattenPaths(obj: Record<string, unknown>): Record<string, unknown> {\n return _flattenPaths(obj, '', 0);\n}\n\n/**\n * Reconstructs a nested plain object from a map of dot-notation path keys to leaf values.\n * Any path containing an unsafe segment is silently skipped.\n *\n * @example\n * ```ts\n * unflattenPaths({ 'a.b': 1, 'a.c': 2, 'd': 3 })\n * // { a: { b: 1, c: 2 }, d: 3 }\n * ```\n */\nexport function unflattenPaths(flat: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const [key, val] of Object.entries(flat)) {\n const parts = key.split('.');\n\n if (parts.some((p) => UNSAFE_PATH_SEGMENTS.has(p))) continue;\n\n let obj = result;\n\n for (let i = 0; i < parts.length - 1; i++) {\n if (!isPlainObject(obj[parts[i]])) {\n obj[parts[i]] = {};\n }\n\n obj = obj[parts[i]] as Record<string, unknown>;\n }\n\n obj[parts[parts.length - 1]] = val;\n }\n\n return result;\n}\n"],"mappings":"4HAcA,IAAM,EAAoB,GAE1B,SAAS,cAAc,EAA8B,EAAgB,EAAwC,CAC3G,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAG,EAAG,CAC5C,GAAI,EAAqB,IAAI,CAAG,EAAG,SAEnC,IAAM,EAAU,EAAS,GAAG,EAAO,GAAG,IAAQ,EAE1C,EAAc,CAAG,GAAK,EAAQ,EAChC,OAAO,OAAO,EAAQ,cAAc,EAAgC,EAAS,EAAQ,CAAC,CAAC,EAEvF,EAAO,GAAW,CAEtB,CAEA,OAAO,CACT,CAEA,SAAgB,aAAa,EAAuD,CAClF,OAAO,cAAc,EAAK,GAAI,CAAC,CACjC,CAYA,SAAgB,eAAe,EAAwD,CACrF,IAAM,EAAkC,CAAC,EAEzC,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,CAAI,EAAG,CAC7C,IAAM,EAAQ,EAAI,MAAM,GAAG,EAE3B,GAAI,EAAM,KAAM,GAAM,EAAqB,IAAI,CAAC,CAAC,EAAG,SAEpD,IAAI,EAAM,EAEV,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAS,EAAG,IAC/B,EAAc,EAAI,EAAM,GAAG,IAC9B,EAAI,EAAM,IAAM,CAAC,GAGnB,EAAM,EAAI,EAAM,IAGlB,EAAI,EAAM,EAAM,OAAS,IAAM,CACjC,CAEA,OAAO,CACT"}
@@ -1,2 +1,2 @@
1
- const e=require("../_common/unsafePaths.cjs");function t(e){return e.replace(/\[(\d+)\]/g,`.$1`).replace(/^\.|\.$/g,``).split(`.`).filter(Boolean)}function n(n,r){let i=n;for(let n of t(r))if(e.UNSAFE_PATH_SEGMENTS.has(n)||typeof i!=`object`||!i||(i=i[n],i===void 0))return;return i}function r(e,t){return n(e,t)}function i(e,t,r){let i=n(e,t);return i===void 0?r:i}function a(e,t){let r=n(e,t);if(r===void 0)throw TypeError(`Path does not exist: '${t}'`);return r}exports.getPath=r,exports.getPathOr=i,exports.requirePath=a;
1
+ const e=require("../_common/unsafePaths.cjs");function pathSegments(e){return e.replace(/\[(\d+)\]/g,`.$1`).replace(/^\.|\.$/g,``).split(`.`).filter(Boolean)}function readPath(t,n){let r=t;for(let t of pathSegments(n))if(e.UNSAFE_PATH_SEGMENTS.has(t)||typeof r!=`object`||!r||(r=r[t],r===void 0))return;return r}function getPath(e,t){return readPath(e,t)}function getPathOr(e,t,n){let r=readPath(e,t);return r===void 0?n:r}function requirePath(e,t){let n=readPath(e,t);if(n===void 0)throw TypeError(`Path does not exist: '${t}'`);return n}exports.getPath=getPath,exports.getPathOr=getPathOr,exports.requirePath=requirePath;
2
2
  //# sourceMappingURL=getPath.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPath.cjs","names":[],"sources":["../../src/object/getPath.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n"],"mappings":"8CAWA,SAAS,EAAa,EAAwB,CAC5C,OAAO,EACJ,QAAQ,aAAc,KAAK,CAAC,CAC5B,QAAQ,WAAY,EAAE,CAAC,CACvB,MAAM,GAAG,CAAC,CACV,OAAO,OAAO,CACnB,CAEA,SAAS,EAAS,EAAW,EAAuB,CAClD,IAAI,EAAmB,EAEvB,IAAK,IAAM,KAAW,EAAa,CAAI,EAKrC,GAJI,EAAA,qBAAqB,IAAI,CAAO,GAAwB,OAAO,GAAY,WAAtC,IAEzC,EAAW,EAAoC,GAE3C,IAAY,IAAA,IAAW,OAG7B,OAAO,CACT,CAOA,SAAgB,EAAyC,EAAS,EAAsC,CACtG,OAAO,EAAS,EAAM,CAAI,CAC5B,CAKA,SAAgB,EAA8C,EAAS,EAAS,EAAkC,CAChH,IAAM,EAAQ,EAAS,EAAM,CAAI,EAEjC,OAAQ,IAAU,IAAA,GAAY,EAAW,CAC3C,CAKA,SAAgB,EAA6C,EAAS,EAA8C,CAClH,IAAM,EAAQ,EAAS,EAAM,CAAI,EAEjC,GAAI,IAAU,IAAA,GAAW,MAAU,UAAU,yBAAyB,EAAK,EAAE,EAE7E,OAAO,CACT"}
1
+ {"version":3,"file":"getPath.cjs","names":[],"sources":["../../src/object/getPath.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n"],"mappings":"8CAWA,SAAS,aAAa,EAAwB,CAC5C,OAAO,EACJ,QAAQ,aAAc,KAAK,CAAC,CAC5B,QAAQ,WAAY,EAAE,CAAC,CACvB,MAAM,GAAG,CAAC,CACV,OAAO,OAAO,CACnB,CAEA,SAAS,SAAS,EAAW,EAAuB,CAClD,IAAI,EAAmB,EAEvB,IAAK,IAAM,KAAW,aAAa,CAAI,EAKrC,GAJI,EAAA,qBAAqB,IAAI,CAAO,GAAwB,OAAO,GAAY,WAAtC,IAEzC,EAAW,EAAoC,GAE3C,IAAY,IAAA,IAAW,OAG7B,OAAO,CACT,CAOA,SAAgB,QAAyC,EAAS,EAAsC,CACtG,OAAO,SAAS,EAAM,CAAI,CAC5B,CAKA,SAAgB,UAA8C,EAAS,EAAS,EAAkC,CAChH,IAAM,EAAQ,SAAS,EAAM,CAAI,EAEjC,OAAQ,IAAU,IAAA,GAAY,EAAW,CAC3C,CAKA,SAAgB,YAA6C,EAAS,EAA8C,CAClH,IAAM,EAAQ,SAAS,EAAM,CAAI,EAEjC,GAAI,IAAU,IAAA,GAAW,MAAU,UAAU,yBAAyB,EAAK,EAAE,EAE7E,OAAO,CACT"}
@@ -1,26 +1,2 @@
1
- import { UNSAFE_PATH_SEGMENTS as e } from "../_common/unsafePaths.js";
2
- //#region src/object/getPath.ts
3
- function t(e) {
4
- return e.replace(/\[(\d+)\]/g, ".$1").replace(/^\.|\.$/g, "").split(".").filter(Boolean);
5
- }
6
- function n(n, r) {
7
- let i = n;
8
- for (let n of t(r)) if (e.has(n) || typeof i != "object" || !i || (i = i[n], i === void 0)) return;
9
- return i;
10
- }
11
- function r(e, t) {
12
- return n(e, t);
13
- }
14
- function i(e, t, r) {
15
- let i = n(e, t);
16
- return i === void 0 ? r : i;
17
- }
18
- function a(e, t) {
19
- let r = n(e, t);
20
- if (r === void 0) throw TypeError(`Path does not exist: '${t}'`);
21
- return r;
22
- }
23
- //#endregion
24
- export { r as getPath, i as getPathOr, a as requirePath };
25
-
1
+ import{UNSAFE_PATH_SEGMENTS as e}from"../_common/unsafePaths.js";function pathSegments(e){return e.replace(/\[(\d+)\]/g,`.$1`).replace(/^\.|\.$/g,``).split(`.`).filter(Boolean)}function readPath(t,n){let r=t;for(let t of pathSegments(n))if(e.has(t)||typeof r!=`object`||!r||(r=r[t],r===void 0))return;return r}function getPath(e,t){return readPath(e,t)}function getPathOr(e,t,n){let r=readPath(e,t);return r===void 0?n:r}function requirePath(e,t){let n=readPath(e,t);if(n===void 0)throw TypeError(`Path does not exist: '${t}'`);return n}export{getPath,getPathOr,requirePath};
26
2
  //# sourceMappingURL=getPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPath.js","names":[],"sources":["../../src/object/getPath.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n"],"mappings":";;AAWA,SAAS,EAAa,GAAwB;CAC5C,OAAO,EACJ,QAAQ,cAAc,KAAK,CAAC,CAC5B,QAAQ,YAAY,EAAE,CAAC,CACvB,MAAM,GAAG,CAAC,CACV,OAAO,OAAO;AACnB;AAEA,SAAS,EAAS,GAAW,GAAuB;CAClD,IAAI,IAAmB;CAEvB,KAAK,IAAM,KAAW,EAAa,CAAI,GAKrC,IAJI,EAAqB,IAAI,CAAO,KAAwB,OAAO,KAAY,aAAtC,MAEzC,IAAW,EAAoC,IAE3C,MAAY,KAAA,IAAW;CAG7B,OAAO;AACT;AAOA,SAAgB,EAAyC,GAAS,GAAsC;CACtG,OAAO,EAAS,GAAM,CAAI;AAC5B;AAKA,SAAgB,EAA8C,GAAS,GAAS,GAAkC;CAChH,IAAM,IAAQ,EAAS,GAAM,CAAI;CAEjC,OAAQ,MAAU,KAAA,IAAY,IAAW;AAC3C;AAKA,SAAgB,EAA6C,GAAS,GAA8C;CAClH,IAAM,IAAQ,EAAS,GAAM,CAAI;CAEjC,IAAI,MAAU,KAAA,GAAW,MAAU,UAAU,yBAAyB,EAAK,EAAE;CAE7E,OAAO;AACT"}
1
+ {"version":3,"file":"getPath.js","names":[],"sources":["../../src/object/getPath.ts"],"sourcesContent":["import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n"],"mappings":"iEAWA,SAAS,aAAa,EAAwB,CAC5C,OAAO,EACJ,QAAQ,aAAc,KAAK,CAAC,CAC5B,QAAQ,WAAY,EAAE,CAAC,CACvB,MAAM,GAAG,CAAC,CACV,OAAO,OAAO,CACnB,CAEA,SAAS,SAAS,EAAW,EAAuB,CAClD,IAAI,EAAmB,EAEvB,IAAK,IAAM,KAAW,aAAa,CAAI,EAKrC,GAJI,EAAqB,IAAI,CAAO,GAAwB,OAAO,GAAY,WAAtC,IAEzC,EAAW,EAAoC,GAE3C,IAAY,IAAA,IAAW,OAG7B,OAAO,CACT,CAOA,SAAgB,QAAyC,EAAS,EAAsC,CACtG,OAAO,SAAS,EAAM,CAAI,CAC5B,CAKA,SAAgB,UAA8C,EAAS,EAAS,EAAkC,CAChH,IAAM,EAAQ,SAAS,EAAM,CAAI,EAEjC,OAAQ,IAAU,IAAA,GAAY,EAAW,CAC3C,CAKA,SAAgB,YAA6C,EAAS,EAA8C,CAClH,IAAM,EAAQ,SAAS,EAAM,CAAI,EAEjC,GAAI,IAAU,IAAA,GAAW,MAAU,UAAU,yBAAyB,EAAK,EAAE,EAE7E,OAAO,CACT"}
@@ -1,2 +1,2 @@
1
- const e=require("../errors.cjs");function t(n,r,i){if(n===void 0)return`undefined`;if(n===null)return`null`;if(typeof n==`bigint`)return`${n}n`;if(typeof n!=`object`)return JSON.stringify(n);if(i.has(n))return`[Circular]`;if(i.add(n),n instanceof Date)return`[Date:${Number.isNaN(n.getTime())?`Invalid`:n.toISOString()}]`;if(n instanceof RegExp)return`[RegExp:${n.source}/${n.flags}]`;if(n instanceof Set)return`[Set:${[...n].map(e=>t(e,r,i)).sort().join(`,`)}]`;if(n instanceof Map)return`[Map:${[...n.entries()].map(([e,n])=>[t(e,r,i),t(n,r,i)]).sort(([e,t],[n,r])=>e===n?t.localeCompare(r):e.localeCompare(n)).map(([e,t])=>`${e}=>${t}`).join(`,`)}]`;if(Array.isArray(n))return`[${n.map(e=>t(e,r,i)).join(`,`)}]`;let a=Object.getPrototypeOf(n);if(a!==Object.prototype&&a!==null){if(r?.onClassInstance===`throw`)throw new e.ArsenalSerializationError(`hash: unsupported type ${n.constructor?.name??`unknown`}`);return String(n)}let o=n;return`{${Object.keys(o).filter(e=>o[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${t(o[e],r,i)}`).join(`,`)}}`}function n(e,n){return t(e,n,new Set)}exports.hash=n;
1
+ const e=require("../errors.cjs");function _hash(t,n,r){if(t===void 0)return`undefined`;if(t===null)return`null`;if(typeof t==`bigint`)return`${t}n`;if(typeof t!=`object`)return JSON.stringify(t);if(r.has(t))return`[Circular]`;if(r.add(t),t instanceof Date)return`[Date:${Number.isNaN(t.getTime())?`Invalid`:t.toISOString()}]`;if(t instanceof RegExp)return`[RegExp:${t.source}/${t.flags}]`;if(t instanceof Set)return`[Set:${[...t].map(e=>_hash(e,n,r)).sort().join(`,`)}]`;if(t instanceof Map)return`[Map:${[...t.entries()].map(([e,t])=>[_hash(e,n,r),_hash(t,n,r)]).sort(([e,t],[n,r])=>e===n?t.localeCompare(r):e.localeCompare(n)).map(([e,t])=>`${e}=>${t}`).join(`,`)}]`;if(Array.isArray(t))return`[${t.map(e=>_hash(e,n,r)).join(`,`)}]`;let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null){if(n?.onClassInstance===`throw`)throw new e.ArsenalSerializationError(`hash: unsupported type ${t.constructor?.name??`unknown`}`);return String(t)}let a=t;return`{${Object.keys(a).filter(e=>a[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${_hash(a[e],n,r)}`).join(`,`)}}`}function hash(e,t){return _hash(e,t,new Set)}exports.hash=hash;
2
2
  //# sourceMappingURL=hash.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash.cjs","names":[],"sources":["../../src/object/hash.ts"],"sourcesContent":["import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n"],"mappings":"iCAkCA,SAAS,EAAM,EAAgB,EAAkC,EAA8B,CAC7F,GAAI,IAAU,IAAA,GAAW,MAAO,YAEhC,GAAI,IAAU,KAAM,MAAO,OAE3B,GAAI,OAAO,GAAU,SAAU,MAAO,GAAG,EAAM,GAE/C,GAAI,OAAO,GAAU,SAAU,OAAO,KAAK,UAAU,CAAK,EAE1D,GAAI,EAAQ,IAAI,CAAe,EAAG,MAAO,aAIzC,GAFA,EAAQ,IAAI,CAAe,EAEvB,aAAiB,KAAM,MAAO,SAAS,OAAO,MAAM,EAAM,QAAQ,CAAC,EAAI,UAAY,EAAM,YAAY,EAAE,GAE3G,GAAI,aAAiB,OAAQ,MAAO,WAAW,EAAM,OAAO,GAAG,EAAM,MAAM,GAE3E,GAAI,aAAiB,IACnB,MAAO,QAAQ,CAAC,GAAG,CAAK,CAAC,CACtB,IAAK,GAAM,EAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,KAAK,GAAG,EAAE,GAEf,GAAI,aAAiB,IAOnB,MAAO,QANS,CAAC,GAAG,EAAM,QAAQ,CAAC,CAAC,CACjC,KAAK,CAAC,EAAK,KAAgB,CAAC,EAAM,EAAK,EAAS,CAAO,EAAG,EAAM,EAAY,EAAS,CAAO,CAAC,CAAU,CAAC,CACxG,MAAM,CAAC,EAAS,GAAY,CAAC,EAAU,KACtC,IAAY,EAAW,EAAU,cAAc,CAAU,EAAI,EAAQ,cAAc,CAAQ,CAGhF,CAAA,CAAQ,KAAK,CAAC,EAAK,KAAgB,GAAG,EAAI,IAAI,GAAY,CAAC,CAAC,KAAK,GAAG,EAAE,GAGvF,GAAI,MAAM,QAAQ,CAAK,EAAG,MAAO,IAAI,EAAM,IAAK,GAAM,EAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAE5F,IAAM,EAAQ,OAAO,eAAe,CAAK,EAEzC,GAAI,IAAU,OAAO,WAAa,IAAU,KAAM,CAChD,GAAI,GAAS,kBAAoB,QAC/B,MAAM,IAAI,EAAA,0BACR,0BAA2B,EAA8C,aAAa,MAAQ,WAChG,EAGF,OAAO,OAAO,CAAK,CACrB,CAEA,IAAM,EAAM,EAKZ,MAAO,IAJM,OAAO,KAAK,CAAG,CAAC,CAC1B,OAAQ,GAAM,EAAI,KAAO,IAAA,EAAS,CAAC,CACnC,KAEQ,CAAA,CAAK,IAAK,GAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,EAAM,EAAI,GAAI,EAAS,CAAO,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,EAClG,CAEA,SAAgB,EAAK,EAAgB,EAA+B,CAClE,OAAO,EAAM,EAAO,EAAS,IAAI,GAAa,CAChD"}
1
+ {"version":3,"file":"hash.cjs","names":[],"sources":["../../src/object/hash.ts"],"sourcesContent":["import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n"],"mappings":"iCAkCA,SAAS,MAAM,EAAgB,EAAkC,EAA8B,CAC7F,GAAI,IAAU,IAAA,GAAW,MAAO,YAEhC,GAAI,IAAU,KAAM,MAAO,OAE3B,GAAI,OAAO,GAAU,SAAU,MAAO,GAAG,EAAM,GAE/C,GAAI,OAAO,GAAU,SAAU,OAAO,KAAK,UAAU,CAAK,EAE1D,GAAI,EAAQ,IAAI,CAAe,EAAG,MAAO,aAIzC,GAFA,EAAQ,IAAI,CAAe,EAEvB,aAAiB,KAAM,MAAO,SAAS,OAAO,MAAM,EAAM,QAAQ,CAAC,EAAI,UAAY,EAAM,YAAY,EAAE,GAE3G,GAAI,aAAiB,OAAQ,MAAO,WAAW,EAAM,OAAO,GAAG,EAAM,MAAM,GAE3E,GAAI,aAAiB,IACnB,MAAO,QAAQ,CAAC,GAAG,CAAK,CAAC,CACtB,IAAK,GAAM,MAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,KAAK,GAAG,EAAE,GAEf,GAAI,aAAiB,IAOnB,MAAO,QANS,CAAC,GAAG,EAAM,QAAQ,CAAC,CAAC,CACjC,KAAK,CAAC,EAAK,KAAgB,CAAC,MAAM,EAAK,EAAS,CAAO,EAAG,MAAM,EAAY,EAAS,CAAO,CAAC,CAAU,CAAC,CACxG,MAAM,CAAC,EAAS,GAAY,CAAC,EAAU,KACtC,IAAY,EAAW,EAAU,cAAc,CAAU,EAAI,EAAQ,cAAc,CAAQ,CAGhF,CAAA,CAAQ,KAAK,CAAC,EAAK,KAAgB,GAAG,EAAI,IAAI,GAAY,CAAC,CAAC,KAAK,GAAG,EAAE,GAGvF,GAAI,MAAM,QAAQ,CAAK,EAAG,MAAO,IAAI,EAAM,IAAK,GAAM,MAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAE5F,IAAM,EAAQ,OAAO,eAAe,CAAK,EAEzC,GAAI,IAAU,OAAO,WAAa,IAAU,KAAM,CAChD,GAAI,GAAS,kBAAoB,QAC/B,MAAM,IAAI,EAAA,0BACR,0BAA2B,EAA8C,aAAa,MAAQ,WAChG,EAGF,OAAO,OAAO,CAAK,CACrB,CAEA,IAAM,EAAM,EAKZ,MAAO,IAJM,OAAO,KAAK,CAAG,CAAC,CAC1B,OAAQ,GAAM,EAAI,KAAO,IAAA,EAAS,CAAC,CACnC,KAEQ,CAAA,CAAK,IAAK,GAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,MAAM,EAAI,GAAI,EAAS,CAAO,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,EAClG,CAEA,SAAgB,KAAK,EAAgB,EAA+B,CAClE,OAAO,MAAM,EAAO,EAAS,IAAI,GAAa,CAChD"}
@@ -1,28 +1,2 @@
1
- import { ArsenalSerializationError as e } from "../errors.js";
2
- //#region src/object/hash.ts
3
- function t(n, r, i) {
4
- if (n === void 0) return "undefined";
5
- if (n === null) return "null";
6
- if (typeof n == "bigint") return `${n}n`;
7
- if (typeof n != "object") return JSON.stringify(n);
8
- if (i.has(n)) return "[Circular]";
9
- if (i.add(n), n instanceof Date) return `[Date:${Number.isNaN(n.getTime()) ? "Invalid" : n.toISOString()}]`;
10
- if (n instanceof RegExp) return `[RegExp:${n.source}/${n.flags}]`;
11
- if (n instanceof Set) return `[Set:${[...n].map((e) => t(e, r, i)).sort().join(",")}]`;
12
- if (n instanceof Map) return `[Map:${[...n.entries()].map(([e, n]) => [t(e, r, i), t(n, r, i)]).sort(([e, t], [n, r]) => e === n ? t.localeCompare(r) : e.localeCompare(n)).map(([e, t]) => `${e}=>${t}`).join(",")}]`;
13
- if (Array.isArray(n)) return `[${n.map((e) => t(e, r, i)).join(",")}]`;
14
- let a = Object.getPrototypeOf(n);
15
- if (a !== Object.prototype && a !== null) {
16
- if (r?.onClassInstance === "throw") throw new e(`hash: unsupported type ${n.constructor?.name ?? "unknown"}`);
17
- return String(n);
18
- }
19
- let o = n;
20
- return `{${Object.keys(o).filter((e) => o[e] !== void 0).sort().map((e) => `${JSON.stringify(e)}:${t(o[e], r, i)}`).join(",")}}`;
21
- }
22
- function n(e, n) {
23
- return t(e, n, /* @__PURE__ */ new Set());
24
- }
25
- //#endregion
26
- export { n as hash };
27
-
1
+ import{ArsenalSerializationError as e}from"../errors.js";function _hash(t,n,r){if(t===void 0)return`undefined`;if(t===null)return`null`;if(typeof t==`bigint`)return`${t}n`;if(typeof t!=`object`)return JSON.stringify(t);if(r.has(t))return`[Circular]`;if(r.add(t),t instanceof Date)return`[Date:${Number.isNaN(t.getTime())?`Invalid`:t.toISOString()}]`;if(t instanceof RegExp)return`[RegExp:${t.source}/${t.flags}]`;if(t instanceof Set)return`[Set:${[...t].map(e=>_hash(e,n,r)).sort().join(`,`)}]`;if(t instanceof Map)return`[Map:${[...t.entries()].map(([e,t])=>[_hash(e,n,r),_hash(t,n,r)]).sort(([e,t],[n,r])=>e===n?t.localeCompare(r):e.localeCompare(n)).map(([e,t])=>`${e}=>${t}`).join(`,`)}]`;if(Array.isArray(t))return`[${t.map(e=>_hash(e,n,r)).join(`,`)}]`;let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null){if(n?.onClassInstance===`throw`)throw new e(`hash: unsupported type ${t.constructor?.name??`unknown`}`);return String(t)}let a=t;return`{${Object.keys(a).filter(e=>a[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${_hash(a[e],n,r)}`).join(`,`)}}`}function hash(e,t){return _hash(e,t,new Set)}export{hash};
28
2
  //# sourceMappingURL=hash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","names":[],"sources":["../../src/object/hash.ts"],"sourcesContent":["import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n"],"mappings":";;AAkCA,SAAS,EAAM,GAAgB,GAAkC,GAA8B;CAC7F,IAAI,MAAU,KAAA,GAAW,OAAO;CAEhC,IAAI,MAAU,MAAM,OAAO;CAE3B,IAAI,OAAO,KAAU,UAAU,OAAO,GAAG,EAAM;CAE/C,IAAI,OAAO,KAAU,UAAU,OAAO,KAAK,UAAU,CAAK;CAE1D,IAAI,EAAQ,IAAI,CAAe,GAAG,OAAO;CAIzC,IAFA,EAAQ,IAAI,CAAe,GAEvB,aAAiB,MAAM,OAAO,SAAS,OAAO,MAAM,EAAM,QAAQ,CAAC,IAAI,YAAY,EAAM,YAAY,EAAE;CAE3G,IAAI,aAAiB,QAAQ,OAAO,WAAW,EAAM,OAAO,GAAG,EAAM,MAAM;CAE3E,IAAI,aAAiB,KACnB,OAAO,QAAQ,CAAC,GAAG,CAAK,CAAC,CACtB,KAAK,MAAM,EAAM,GAAG,GAAS,CAAO,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,KAAK,GAAG,EAAE;CAEf,IAAI,aAAiB,KAOnB,OAAO,QANS,CAAC,GAAG,EAAM,QAAQ,CAAC,CAAC,CACjC,KAAK,CAAC,GAAK,OAAgB,CAAC,EAAM,GAAK,GAAS,CAAO,GAAG,EAAM,GAAY,GAAS,CAAO,CAAC,CAAU,CAAC,CACxG,MAAM,CAAC,GAAS,IAAY,CAAC,GAAU,OACtC,MAAY,IAAW,EAAU,cAAc,CAAU,IAAI,EAAQ,cAAc,CAAQ,CAGhF,CAAA,CAAQ,KAAK,CAAC,GAAK,OAAgB,GAAG,EAAI,IAAI,GAAY,CAAC,CAAC,KAAK,GAAG,EAAE;CAGvF,IAAI,MAAM,QAAQ,CAAK,GAAG,OAAO,IAAI,EAAM,KAAK,MAAM,EAAM,GAAG,GAAS,CAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;CAE5F,IAAM,IAAQ,OAAO,eAAe,CAAK;CAEzC,IAAI,MAAU,OAAO,aAAa,MAAU,MAAM;EAChD,IAAI,GAAS,oBAAoB,SAC/B,MAAM,IAAI,EACR,0BAA2B,EAA8C,aAAa,QAAQ,WAChG;EAGF,OAAO,OAAO,CAAK;CACrB;CAEA,IAAM,IAAM;CAKZ,OAAO,IAJM,OAAO,KAAK,CAAG,CAAC,CAC1B,QAAQ,MAAM,EAAI,OAAO,KAAA,CAAS,CAAC,CACnC,KAEQ,CAAA,CAAK,KAAK,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,EAAM,EAAI,IAAI,GAAS,CAAO,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;AAClG;AAEA,SAAgB,EAAK,GAAgB,GAA+B;CAClE,OAAO,EAAM,GAAO,mBAAS,IAAI,IAAY,CAAC;AAChD"}
1
+ {"version":3,"file":"hash.js","names":[],"sources":["../../src/object/hash.ts"],"sourcesContent":["import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n"],"mappings":"yDAkCA,SAAS,MAAM,EAAgB,EAAkC,EAA8B,CAC7F,GAAI,IAAU,IAAA,GAAW,MAAO,YAEhC,GAAI,IAAU,KAAM,MAAO,OAE3B,GAAI,OAAO,GAAU,SAAU,MAAO,GAAG,EAAM,GAE/C,GAAI,OAAO,GAAU,SAAU,OAAO,KAAK,UAAU,CAAK,EAE1D,GAAI,EAAQ,IAAI,CAAe,EAAG,MAAO,aAIzC,GAFA,EAAQ,IAAI,CAAe,EAEvB,aAAiB,KAAM,MAAO,SAAS,OAAO,MAAM,EAAM,QAAQ,CAAC,EAAI,UAAY,EAAM,YAAY,EAAE,GAE3G,GAAI,aAAiB,OAAQ,MAAO,WAAW,EAAM,OAAO,GAAG,EAAM,MAAM,GAE3E,GAAI,aAAiB,IACnB,MAAO,QAAQ,CAAC,GAAG,CAAK,CAAC,CACtB,IAAK,GAAM,MAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,KAAK,GAAG,EAAE,GAEf,GAAI,aAAiB,IAOnB,MAAO,QANS,CAAC,GAAG,EAAM,QAAQ,CAAC,CAAC,CACjC,KAAK,CAAC,EAAK,KAAgB,CAAC,MAAM,EAAK,EAAS,CAAO,EAAG,MAAM,EAAY,EAAS,CAAO,CAAC,CAAU,CAAC,CACxG,MAAM,CAAC,EAAS,GAAY,CAAC,EAAU,KACtC,IAAY,EAAW,EAAU,cAAc,CAAU,EAAI,EAAQ,cAAc,CAAQ,CAGhF,CAAA,CAAQ,KAAK,CAAC,EAAK,KAAgB,GAAG,EAAI,IAAI,GAAY,CAAC,CAAC,KAAK,GAAG,EAAE,GAGvF,GAAI,MAAM,QAAQ,CAAK,EAAG,MAAO,IAAI,EAAM,IAAK,GAAM,MAAM,EAAG,EAAS,CAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAE5F,IAAM,EAAQ,OAAO,eAAe,CAAK,EAEzC,GAAI,IAAU,OAAO,WAAa,IAAU,KAAM,CAChD,GAAI,GAAS,kBAAoB,QAC/B,MAAM,IAAI,EACR,0BAA2B,EAA8C,aAAa,MAAQ,WAChG,EAGF,OAAO,OAAO,CAAK,CACrB,CAEA,IAAM,EAAM,EAKZ,MAAO,IAJM,OAAO,KAAK,CAAG,CAAC,CAC1B,OAAQ,GAAM,EAAI,KAAO,IAAA,EAAS,CAAC,CACnC,KAEQ,CAAA,CAAK,IAAK,GAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,MAAM,EAAI,GAAI,EAAS,CAAO,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,EAClG,CAEA,SAAgB,KAAK,EAAgB,EAA+B,CAClE,OAAO,MAAM,EAAO,EAAS,IAAI,GAAa,CAChD"}