ts-data-forge 1.5.1 → 2.0.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 (82) hide show
  1. package/README.md +13 -1
  2. package/dist/array/array-utils.d.mts +693 -351
  3. package/dist/array/array-utils.d.mts.map +1 -1
  4. package/dist/array/array-utils.mjs +474 -1541
  5. package/dist/array/array-utils.mjs.map +1 -1
  6. package/dist/array/index.d.mts +0 -1
  7. package/dist/array/index.d.mts.map +1 -1
  8. package/dist/array/index.mjs +0 -1
  9. package/dist/array/index.mjs.map +1 -1
  10. package/dist/collections/imap-mapped.mjs.map +1 -1
  11. package/dist/collections/imap.mjs.map +1 -1
  12. package/dist/collections/iset-mapped.mjs.map +1 -1
  13. package/dist/collections/iset.mjs.map +1 -1
  14. package/dist/collections/queue.mjs +0 -1
  15. package/dist/collections/queue.mjs.map +1 -1
  16. package/dist/collections/stack.mjs +4 -5
  17. package/dist/collections/stack.mjs.map +1 -1
  18. package/dist/functional/match.d.mts +2 -33
  19. package/dist/functional/match.d.mts.map +1 -1
  20. package/dist/functional/match.mjs +2 -119
  21. package/dist/functional/match.mjs.map +1 -1
  22. package/dist/functional/optional.d.mts +29 -51
  23. package/dist/functional/optional.d.mts.map +1 -1
  24. package/dist/functional/optional.mjs +40 -171
  25. package/dist/functional/optional.mjs.map +1 -1
  26. package/dist/functional/pipe.d.mts +2 -15
  27. package/dist/functional/pipe.d.mts.map +1 -1
  28. package/dist/functional/pipe.mjs +2 -110
  29. package/dist/functional/pipe.mjs.map +1 -1
  30. package/dist/functional/result.d.mts +18 -45
  31. package/dist/functional/result.d.mts.map +1 -1
  32. package/dist/functional/result.mjs +40 -196
  33. package/dist/functional/result.mjs.map +1 -1
  34. package/dist/globals.d.mts +10 -9
  35. package/dist/index.mjs +0 -1
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/iterator/range.d.mts +2 -6
  38. package/dist/iterator/range.d.mts.map +1 -1
  39. package/dist/iterator/range.mjs +2 -93
  40. package/dist/iterator/range.mjs.map +1 -1
  41. package/dist/json/json.mjs +0 -1
  42. package/dist/json/json.mjs.map +1 -1
  43. package/dist/number/num.d.mts +3 -6
  44. package/dist/number/num.d.mts.map +1 -1
  45. package/dist/number/num.mjs +4 -22
  46. package/dist/number/num.mjs.map +1 -1
  47. package/dist/number/refined-number-utils.mjs.map +1 -1
  48. package/dist/object/object.d.mts +4 -10
  49. package/dist/object/object.d.mts.map +1 -1
  50. package/dist/object/object.mjs +8 -140
  51. package/dist/object/object.mjs.map +1 -1
  52. package/dist/others/map-nullable.d.mts +2 -6
  53. package/dist/others/map-nullable.d.mts.map +1 -1
  54. package/dist/others/map-nullable.mjs +2 -146
  55. package/dist/others/map-nullable.mjs.map +1 -1
  56. package/dist/others/memoize-function.mjs.map +1 -1
  57. package/dist/others/unknown-to-string.mjs.map +1 -1
  58. package/package.json +12 -12
  59. package/src/array/array-utils-modification.test.mts +93 -67
  60. package/src/array/array-utils-overload-type-error.test.mts +2 -2
  61. package/src/array/array-utils-reducing-value.test.mts +31 -37
  62. package/src/array/array-utils-slice-clamped.test.mts +94 -70
  63. package/src/array/array-utils-transformation.test.mts +557 -10
  64. package/src/array/array-utils.mts +1835 -1000
  65. package/src/array/index.mts +0 -1
  66. package/src/collections/queue.mts +2 -2
  67. package/src/collections/stack.mts +8 -8
  68. package/src/functional/match.mts +18 -44
  69. package/src/functional/optional.mts +88 -102
  70. package/src/functional/pipe.mts +25 -20
  71. package/src/functional/result.mts +114 -124
  72. package/src/globals.d.mts +10 -9
  73. package/src/iterator/range.mts +14 -17
  74. package/src/number/num.mts +16 -12
  75. package/src/object/object.mts +30 -45
  76. package/src/others/map-nullable.mts +13 -15
  77. package/dist/array/tuple-utils.d.mts +0 -421
  78. package/dist/array/tuple-utils.d.mts.map +0 -1
  79. package/dist/array/tuple-utils.mjs +0 -391
  80. package/dist/array/tuple-utils.mjs.map +0 -1
  81. package/src/array/tuple-utils.mts +0 -519
  82. package/src/array/tuple-utils.test.mts +0 -518
package/README.md CHANGED
@@ -7,6 +7,17 @@
7
7
 
8
8
  **ts-data-forge** is a TypeScript utility library that provides type-safe functional programming utilities with zero runtime dependencies. It aims to enhance development robustness, maintainability, and correctness by leveraging TypeScript's powerful type system.
9
9
 
10
+ ## Perfect Companion to ts-type-forge
11
+
12
+ **ts-data-forge** is designed as the ideal runtime companion to [**ts-type-forge**](https://github.com/noshiro-pf/ts-type-forge), a powerful type utility library. While ts-type-forge provides compile-time type utilities for advanced TypeScript type manipulation, ts-data-forge complements it with runtime utilities that maintain the same level of type safety.
13
+
14
+ Together, they form a complete TypeScript development toolkit:
15
+
16
+ - **ts-type-forge**: Compile-time type utilities (type manipulation, type inference, advanced type patterns)
17
+ - **ts-data-forge**: Runtime utilities with strong type safety (type guards, branded types, functional programming utilities)
18
+
19
+ This synergy enables you to build fully type-safe applications from compile-time to runtime, ensuring type correctness throughout your entire codebase.
20
+
10
21
  ## Features
11
22
 
12
23
  This library offers a range of utilities, including:
@@ -532,7 +543,8 @@ assert.deepStrictEqual(updatedState.items, ['newItem1', 'newItem2']);
532
543
 
533
544
  **Important Notes:**
534
545
 
535
- - This library **only supports ESM (ES Modules)**. CommonJS is not supported.
546
+ - This library **only supports ESM (ES Modules)** and is designed for native ESM environments. CommonJS is not supported.
547
+ - The library uses `.mts` file extensions and proper ESM exports, making it compatible with modern Node.js ESM resolution and bundlers that support native ESM.
536
548
  - This library uses advanced TypeScript features, including branded types for enhanced type safety. Some functions require specific branded types as parameters (such as `Uint32` in `newArray`). The examples above use the small literal numeric values specifically allowed in each function for brevity, but in actual use you should use the provided type conversion functions (such as `asUint32`) or cast to the appropriate branded type, for example `as Uint32`.
537
549
 
538
550
  ## Removing `expectType` in Production