@bemoje/iter 1.2.0 → 1.2.2

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 (137) hide show
  1. package/lib/index.cjs +327 -234
  2. package/lib/index.d.cts +524 -33
  3. package/lib/index.d.ts +524 -33
  4. package/lib/index.js +295 -33
  5. package/package.json +152 -284
  6. package/lib/filterArray.cjs +0 -18
  7. package/lib/filterArray.d.cts +0 -18
  8. package/lib/filterArray.d.ts +0 -18
  9. package/lib/filterArray.js +0 -16
  10. package/lib/filterIterable.cjs +0 -14
  11. package/lib/filterIterable.d.cts +0 -18
  12. package/lib/filterIterable.d.ts +0 -18
  13. package/lib/filterIterable.js +0 -11
  14. package/lib/filterIterableEntries.cjs +0 -12
  15. package/lib/filterIterableEntries.d.cts +0 -18
  16. package/lib/filterIterableEntries.d.ts +0 -18
  17. package/lib/filterIterableEntries.js +0 -9
  18. package/lib/filterIterableKeys.cjs +0 -14
  19. package/lib/filterIterableKeys.d.cts +0 -18
  20. package/lib/filterIterableKeys.d.ts +0 -18
  21. package/lib/filterIterableKeys.js +0 -11
  22. package/lib/filterIterableValues.cjs +0 -14
  23. package/lib/filterIterableValues.d.cts +0 -18
  24. package/lib/filterIterableValues.d.ts +0 -18
  25. package/lib/filterIterableValues.js +0 -11
  26. package/lib/filterMap.cjs +0 -16
  27. package/lib/filterMap.d.cts +0 -18
  28. package/lib/filterMap.d.ts +0 -18
  29. package/lib/filterMap.js +0 -14
  30. package/lib/filterObject.cjs +0 -18
  31. package/lib/filterObject.d.cts +0 -18
  32. package/lib/filterObject.d.ts +0 -18
  33. package/lib/filterObject.js +0 -15
  34. package/lib/filterSet.cjs +0 -16
  35. package/lib/filterSet.d.cts +0 -18
  36. package/lib/filterSet.d.ts +0 -18
  37. package/lib/filterSet.js +0 -14
  38. package/lib/forEachArray.cjs +0 -14
  39. package/lib/forEachArray.d.cts +0 -17
  40. package/lib/forEachArray.d.ts +0 -17
  41. package/lib/forEachArray.js +0 -12
  42. package/lib/forEachIterable.cjs +0 -14
  43. package/lib/forEachIterable.d.cts +0 -17
  44. package/lib/forEachIterable.d.ts +0 -17
  45. package/lib/forEachIterable.js +0 -11
  46. package/lib/forEachIterableEntries.cjs +0 -14
  47. package/lib/forEachIterableEntries.d.cts +0 -6
  48. package/lib/forEachIterableEntries.d.ts +0 -6
  49. package/lib/forEachIterableEntries.js +0 -11
  50. package/lib/forEachIterableKeys.cjs +0 -14
  51. package/lib/forEachIterableKeys.d.cts +0 -17
  52. package/lib/forEachIterableKeys.d.ts +0 -17
  53. package/lib/forEachIterableKeys.js +0 -11
  54. package/lib/forEachIterableValues.cjs +0 -14
  55. package/lib/forEachIterableValues.d.cts +0 -17
  56. package/lib/forEachIterableValues.d.ts +0 -17
  57. package/lib/forEachIterableValues.js +0 -11
  58. package/lib/forEachMap.cjs +0 -12
  59. package/lib/forEachMap.d.cts +0 -17
  60. package/lib/forEachMap.d.ts +0 -17
  61. package/lib/forEachMap.js +0 -10
  62. package/lib/forEachObject.cjs +0 -14
  63. package/lib/forEachObject.d.cts +0 -17
  64. package/lib/forEachObject.d.ts +0 -17
  65. package/lib/forEachObject.js +0 -11
  66. package/lib/forEachSet.cjs +0 -12
  67. package/lib/forEachSet.d.cts +0 -17
  68. package/lib/forEachSet.d.ts +0 -17
  69. package/lib/forEachSet.js +0 -10
  70. package/lib/mapArray.cjs +0 -16
  71. package/lib/mapArray.d.cts +0 -17
  72. package/lib/mapArray.d.ts +0 -17
  73. package/lib/mapArray.js +0 -14
  74. package/lib/mapIterable.cjs +0 -14
  75. package/lib/mapIterable.d.cts +0 -17
  76. package/lib/mapIterable.d.ts +0 -17
  77. package/lib/mapIterable.js +0 -11
  78. package/lib/mapIterableEntries.cjs +0 -12
  79. package/lib/mapIterableEntries.d.cts +0 -17
  80. package/lib/mapIterableEntries.d.ts +0 -17
  81. package/lib/mapIterableEntries.js +0 -9
  82. package/lib/mapIterableKeys.cjs +0 -17
  83. package/lib/mapIterableKeys.d.cts +0 -17
  84. package/lib/mapIterableKeys.d.ts +0 -17
  85. package/lib/mapIterableKeys.js +0 -14
  86. package/lib/mapIterableValues.cjs +0 -17
  87. package/lib/mapIterableValues.d.cts +0 -17
  88. package/lib/mapIterableValues.d.ts +0 -17
  89. package/lib/mapIterableValues.js +0 -14
  90. package/lib/mapMap.cjs +0 -14
  91. package/lib/mapMap.d.cts +0 -17
  92. package/lib/mapMap.d.ts +0 -17
  93. package/lib/mapMap.js +0 -12
  94. package/lib/mapObject.cjs +0 -16
  95. package/lib/mapObject.d.cts +0 -17
  96. package/lib/mapObject.d.ts +0 -17
  97. package/lib/mapObject.js +0 -13
  98. package/lib/mapSet.cjs +0 -14
  99. package/lib/mapSet.d.cts +0 -17
  100. package/lib/mapSet.d.ts +0 -17
  101. package/lib/mapSet.js +0 -12
  102. package/lib/reduceArray.cjs +0 -16
  103. package/lib/reduceArray.d.cts +0 -18
  104. package/lib/reduceArray.d.ts +0 -18
  105. package/lib/reduceArray.js +0 -14
  106. package/lib/reduceIterable.cjs +0 -14
  107. package/lib/reduceIterable.d.cts +0 -18
  108. package/lib/reduceIterable.d.ts +0 -18
  109. package/lib/reduceIterable.js +0 -12
  110. package/lib/reduceIterableEntries.cjs +0 -14
  111. package/lib/reduceIterableEntries.d.cts +0 -18
  112. package/lib/reduceIterableEntries.d.ts +0 -18
  113. package/lib/reduceIterableEntries.js +0 -12
  114. package/lib/reduceIterableKeys.cjs +0 -14
  115. package/lib/reduceIterableKeys.d.cts +0 -18
  116. package/lib/reduceIterableKeys.d.ts +0 -18
  117. package/lib/reduceIterableKeys.js +0 -12
  118. package/lib/reduceIterableValues.cjs +0 -14
  119. package/lib/reduceIterableValues.d.cts +0 -18
  120. package/lib/reduceIterableValues.d.ts +0 -18
  121. package/lib/reduceIterableValues.js +0 -12
  122. package/lib/reduceMap.cjs +0 -14
  123. package/lib/reduceMap.d.cts +0 -18
  124. package/lib/reduceMap.d.ts +0 -18
  125. package/lib/reduceMap.js +0 -12
  126. package/lib/reduceObject.cjs +0 -16
  127. package/lib/reduceObject.d.cts +0 -18
  128. package/lib/reduceObject.d.ts +0 -18
  129. package/lib/reduceObject.js +0 -13
  130. package/lib/reduceSet.cjs +0 -14
  131. package/lib/reduceSet.d.cts +0 -18
  132. package/lib/reduceSet.d.ts +0 -18
  133. package/lib/reduceSet.js +0 -12
  134. package/lib/toObjectIterable.cjs +0 -18
  135. package/lib/toObjectIterable.d.cts +0 -7
  136. package/lib/toObjectIterable.d.ts +0 -7
  137. package/lib/toObjectIterable.js +0 -16
package/lib/reduceMap.cjs DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function reduceMap(map, reducer, initial) {
6
- let accumulator = initial;
7
- for (const [key, value] of map) {
8
- accumulator = reducer(accumulator, value, key);
9
- }
10
- return accumulator;
11
- }
12
- __name(reduceMap, "reduceMap");
13
-
14
- exports.reduceMap = reduceMap;
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce a Map to a single value using a reducer function.
3
- *
4
- * @param map - The Map to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const map = new Map([['a', 1], ['b', 2], ['c', 3]])
12
- * const sum = reduceMap(map, (acc, value, key) => acc + value, 0)
13
- * // sum: 6
14
- * ```
15
- */
16
- declare function reduceMap<K, V, R>(map: ReadonlyMap<K, V>, reducer: (accumulator: R, value: V, key: K) => R, initial: R): R;
17
-
18
- export { reduceMap };
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce a Map to a single value using a reducer function.
3
- *
4
- * @param map - The Map to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const map = new Map([['a', 1], ['b', 2], ['c', 3]])
12
- * const sum = reduceMap(map, (acc, value, key) => acc + value, 0)
13
- * // sum: 6
14
- * ```
15
- */
16
- declare function reduceMap<K, V, R>(map: ReadonlyMap<K, V>, reducer: (accumulator: R, value: V, key: K) => R, initial: R): R;
17
-
18
- export { reduceMap };
package/lib/reduceMap.js DELETED
@@ -1,12 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- function reduceMap(map, reducer, initial) {
4
- let accumulator = initial;
5
- for (const [key, value] of map) {
6
- accumulator = reducer(accumulator, value, key);
7
- }
8
- return accumulator;
9
- }
10
- __name(reduceMap, "reduceMap");
11
-
12
- export { reduceMap };
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var entriesOf = require('@mono/object/entriesOf');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- function reduceObject(object, reducer, initial) {
8
- let accumulator = initial;
9
- for (const [key, value] of entriesOf.entriesOf(object)) {
10
- accumulator = reducer(accumulator, value, key);
11
- }
12
- return accumulator;
13
- }
14
- __name(reduceObject, "reduceObject");
15
-
16
- exports.reduceObject = reduceObject;
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce an object to a single value using a reducer function.
3
- *
4
- * @param object - The object to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const obj = { a: 1, b: 2, c: 3 }
12
- * const sum = reduceObject(obj, (acc, value, key) => acc + value, 0)
13
- * // sum: 6
14
- * ```
15
- */
16
- declare function reduceObject<T extends Record<string, unknown>, R>(object: T, reducer: (accumulator: R, value: T[keyof T], key: keyof T) => R, initial: R): R;
17
-
18
- export { reduceObject };
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce an object to a single value using a reducer function.
3
- *
4
- * @param object - The object to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const obj = { a: 1, b: 2, c: 3 }
12
- * const sum = reduceObject(obj, (acc, value, key) => acc + value, 0)
13
- * // sum: 6
14
- * ```
15
- */
16
- declare function reduceObject<T extends Record<string, unknown>, R>(object: T, reducer: (accumulator: R, value: T[keyof T], key: keyof T) => R, initial: R): R;
17
-
18
- export { reduceObject };
@@ -1,13 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
- import { entriesOf } from '@mono/object/entriesOf';
3
-
4
- function reduceObject(object, reducer, initial) {
5
- let accumulator = initial;
6
- for (const [key, value] of entriesOf(object)) {
7
- accumulator = reducer(accumulator, value, key);
8
- }
9
- return accumulator;
10
- }
11
- __name(reduceObject, "reduceObject");
12
-
13
- export { reduceObject };
package/lib/reduceSet.cjs DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function reduceSet(set, reducer, initial) {
6
- let accumulator = initial;
7
- for (const value of set) {
8
- accumulator = reducer(accumulator, value);
9
- }
10
- return accumulator;
11
- }
12
- __name(reduceSet, "reduceSet");
13
-
14
- exports.reduceSet = reduceSet;
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce a Set to a single value using a reducer function.
3
- *
4
- * @param set - The Set to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const set = new Set([1, 2, 3, 4, 5])
12
- * const sum = reduceSet(set, (acc, n) => acc + n, 0)
13
- * // sum: 15
14
- * ```
15
- */
16
- declare function reduceSet<V, R>(set: ReadonlySet<V>, reducer: (accumulator: R, value: V) => R, initial: R): R;
17
-
18
- export { reduceSet };
@@ -1,18 +0,0 @@
1
- /**
2
- * Reduce a Set to a single value using a reducer function.
3
- *
4
- * @param set - The Set to reduce
5
- * @param reducer - A function that combines values
6
- * @param initial - The initial value for the reduction
7
- * @returns The reduced value
8
- *
9
- * @example
10
- * ```ts
11
- * const set = new Set([1, 2, 3, 4, 5])
12
- * const sum = reduceSet(set, (acc, n) => acc + n, 0)
13
- * // sum: 15
14
- * ```
15
- */
16
- declare function reduceSet<V, R>(set: ReadonlySet<V>, reducer: (accumulator: R, value: V) => R, initial: R): R;
17
-
18
- export { reduceSet };
package/lib/reduceSet.js DELETED
@@ -1,12 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- function reduceSet(set, reducer, initial) {
4
- let accumulator = initial;
5
- for (const value of set) {
6
- accumulator = reducer(accumulator, value);
7
- }
8
- return accumulator;
9
- }
10
- __name(reduceSet, "reduceSet");
11
-
12
- export { reduceSet };
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function toObjectIterable(mapLike) {
6
- const object = {};
7
- for (const [key, value] of mapLike) {
8
- if (typeof key !== "string" && typeof key !== "number" && typeof key !== "symbol") {
9
- object[String(key)] = value;
10
- } else {
11
- object[key] = value;
12
- }
13
- }
14
- return object;
15
- }
16
- __name(toObjectIterable, "toObjectIterable");
17
-
18
- exports.toObjectIterable = toObjectIterable;
@@ -1,7 +0,0 @@
1
- /**
2
- * Convert a map-like iterable to a regular object.
3
- */
4
- declare function toObjectIterable<K extends string, V>(mapLike: Iterable<[K, V]>): Record<K, V>;
5
- declare function toObjectIterable<K, V>(mapLike: Iterable<[K, V]>): Record<Extract<K, string> | string, V>;
6
-
7
- export { toObjectIterable };
@@ -1,7 +0,0 @@
1
- /**
2
- * Convert a map-like iterable to a regular object.
3
- */
4
- declare function toObjectIterable<K extends string, V>(mapLike: Iterable<[K, V]>): Record<K, V>;
5
- declare function toObjectIterable<K, V>(mapLike: Iterable<[K, V]>): Record<Extract<K, string> | string, V>;
6
-
7
- export { toObjectIterable };
@@ -1,16 +0,0 @@
1
- import { __name } from './chunk-SHUYVCID.js';
2
-
3
- function toObjectIterable(mapLike) {
4
- const object = {};
5
- for (const [key, value] of mapLike) {
6
- if (typeof key !== "string" && typeof key !== "number" && typeof key !== "symbol") {
7
- object[String(key)] = value;
8
- } else {
9
- object[key] = value;
10
- }
11
- }
12
- return object;
13
- }
14
- __name(toObjectIterable, "toObjectIterable");
15
-
16
- export { toObjectIterable };