@bemoje/iter 1.2.1 → 1.2.3
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.
- package/README.md +41 -15
- package/lib/index.cjs +5 -18
- package/lib/index.d.cts +524 -33
- package/lib/index.d.ts +524 -33
- package/lib/index.js +1 -14
- package/package.json +20 -472
- package/lib/filterArray.cjs +0 -20
- package/lib/filterArray.d.cts +0 -18
- package/lib/filterArray.d.ts +0 -18
- package/lib/filterArray.js +0 -18
- package/lib/filterIterable.cjs +0 -14
- package/lib/filterIterable.d.cts +0 -18
- package/lib/filterIterable.d.ts +0 -18
- package/lib/filterIterable.js +0 -12
- package/lib/filterIterableEntries.cjs +0 -12
- package/lib/filterIterableEntries.d.cts +0 -18
- package/lib/filterIterableEntries.d.ts +0 -18
- package/lib/filterIterableEntries.js +0 -10
- package/lib/filterIterableKeys.cjs +0 -14
- package/lib/filterIterableKeys.d.cts +0 -18
- package/lib/filterIterableKeys.d.ts +0 -18
- package/lib/filterIterableKeys.js +0 -12
- package/lib/filterIterableValues.cjs +0 -14
- package/lib/filterIterableValues.d.cts +0 -18
- package/lib/filterIterableValues.d.ts +0 -18
- package/lib/filterIterableValues.js +0 -12
- package/lib/filterMap.cjs +0 -18
- package/lib/filterMap.d.cts +0 -18
- package/lib/filterMap.d.ts +0 -18
- package/lib/filterMap.js +0 -16
- package/lib/filterObject.cjs +0 -24
- package/lib/filterObject.d.cts +0 -18
- package/lib/filterObject.d.ts +0 -18
- package/lib/filterObject.js +0 -22
- package/lib/filterSet.cjs +0 -18
- package/lib/filterSet.d.cts +0 -18
- package/lib/filterSet.d.ts +0 -18
- package/lib/filterSet.js +0 -16
- package/lib/forEachArray.cjs +0 -16
- package/lib/forEachArray.d.cts +0 -17
- package/lib/forEachArray.d.ts +0 -17
- package/lib/forEachArray.js +0 -14
- package/lib/forEachIterable.cjs +0 -14
- package/lib/forEachIterable.d.cts +0 -17
- package/lib/forEachIterable.d.ts +0 -17
- package/lib/forEachIterable.js +0 -12
- package/lib/forEachIterableEntries.cjs +0 -14
- package/lib/forEachIterableEntries.d.cts +0 -6
- package/lib/forEachIterableEntries.d.ts +0 -6
- package/lib/forEachIterableEntries.js +0 -12
- package/lib/forEachIterableKeys.cjs +0 -14
- package/lib/forEachIterableKeys.d.cts +0 -17
- package/lib/forEachIterableKeys.d.ts +0 -17
- package/lib/forEachIterableKeys.js +0 -12
- package/lib/forEachIterableValues.cjs +0 -14
- package/lib/forEachIterableValues.d.cts +0 -17
- package/lib/forEachIterableValues.d.ts +0 -17
- package/lib/forEachIterableValues.js +0 -12
- package/lib/forEachMap.cjs +0 -14
- package/lib/forEachMap.d.cts +0 -17
- package/lib/forEachMap.d.ts +0 -17
- package/lib/forEachMap.js +0 -12
- package/lib/forEachObject.cjs +0 -20
- package/lib/forEachObject.d.cts +0 -17
- package/lib/forEachObject.d.ts +0 -17
- package/lib/forEachObject.js +0 -18
- package/lib/forEachSet.cjs +0 -14
- package/lib/forEachSet.d.cts +0 -17
- package/lib/forEachSet.d.ts +0 -17
- package/lib/forEachSet.js +0 -12
- package/lib/mapArray.cjs +0 -18
- package/lib/mapArray.d.cts +0 -17
- package/lib/mapArray.d.ts +0 -17
- package/lib/mapArray.js +0 -16
- package/lib/mapIterable.cjs +0 -14
- package/lib/mapIterable.d.cts +0 -17
- package/lib/mapIterable.d.ts +0 -17
- package/lib/mapIterable.js +0 -12
- package/lib/mapIterableEntries.cjs +0 -12
- package/lib/mapIterableEntries.d.cts +0 -17
- package/lib/mapIterableEntries.d.ts +0 -17
- package/lib/mapIterableEntries.js +0 -10
- package/lib/mapIterableKeys.cjs +0 -17
- package/lib/mapIterableKeys.d.cts +0 -17
- package/lib/mapIterableKeys.d.ts +0 -17
- package/lib/mapIterableKeys.js +0 -15
- package/lib/mapIterableValues.cjs +0 -17
- package/lib/mapIterableValues.d.cts +0 -17
- package/lib/mapIterableValues.d.ts +0 -17
- package/lib/mapIterableValues.js +0 -15
- package/lib/mapMap.cjs +0 -16
- package/lib/mapMap.d.cts +0 -17
- package/lib/mapMap.d.ts +0 -17
- package/lib/mapMap.js +0 -14
- package/lib/mapObject.cjs +0 -22
- package/lib/mapObject.d.cts +0 -17
- package/lib/mapObject.d.ts +0 -17
- package/lib/mapObject.js +0 -20
- package/lib/mapSet.cjs +0 -16
- package/lib/mapSet.d.cts +0 -17
- package/lib/mapSet.d.ts +0 -17
- package/lib/mapSet.js +0 -14
- package/lib/reduceArray.cjs +0 -18
- package/lib/reduceArray.d.cts +0 -18
- package/lib/reduceArray.d.ts +0 -18
- package/lib/reduceArray.js +0 -16
- package/lib/reduceIterable.cjs +0 -16
- package/lib/reduceIterable.d.cts +0 -18
- package/lib/reduceIterable.d.ts +0 -18
- package/lib/reduceIterable.js +0 -14
- package/lib/reduceIterableEntries.cjs +0 -16
- package/lib/reduceIterableEntries.d.cts +0 -18
- package/lib/reduceIterableEntries.d.ts +0 -18
- package/lib/reduceIterableEntries.js +0 -14
- package/lib/reduceIterableKeys.cjs +0 -16
- package/lib/reduceIterableKeys.d.cts +0 -18
- package/lib/reduceIterableKeys.d.ts +0 -18
- package/lib/reduceIterableKeys.js +0 -14
- package/lib/reduceIterableValues.cjs +0 -16
- package/lib/reduceIterableValues.d.cts +0 -18
- package/lib/reduceIterableValues.d.ts +0 -18
- package/lib/reduceIterableValues.js +0 -14
- package/lib/reduceMap.cjs +0 -16
- package/lib/reduceMap.d.cts +0 -18
- package/lib/reduceMap.d.ts +0 -18
- package/lib/reduceMap.js +0 -14
- package/lib/reduceObject.cjs +0 -22
- package/lib/reduceObject.d.cts +0 -18
- package/lib/reduceObject.d.ts +0 -18
- package/lib/reduceObject.js +0 -20
- package/lib/reduceSet.cjs +0 -16
- package/lib/reduceSet.d.cts +0 -18
- package/lib/reduceSet.d.ts +0 -18
- package/lib/reduceSet.js +0 -14
- package/lib/toObjectIterable.cjs +0 -20
- package/lib/toObjectIterable.d.cts +0 -7
- package/lib/toObjectIterable.d.ts +0 -7
- package/lib/toObjectIterable.js +0 -18
package/lib/reduceObject.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
// ../object/src/entriesOf.ts
|
|
7
|
-
function entriesOf(obj) {
|
|
8
|
-
return Object.entries(obj);
|
|
9
|
-
}
|
|
10
|
-
__name(entriesOf, "entriesOf");
|
|
11
|
-
|
|
12
|
-
// src/reduceObject.ts
|
|
13
|
-
function reduceObject(object, reducer, initial) {
|
|
14
|
-
let accumulator = initial;
|
|
15
|
-
for (const [key, value] of entriesOf(object)) {
|
|
16
|
-
accumulator = reducer(accumulator, value, key);
|
|
17
|
-
}
|
|
18
|
-
return accumulator;
|
|
19
|
-
}
|
|
20
|
-
__name(reduceObject, "reduceObject");
|
|
21
|
-
|
|
22
|
-
exports.reduceObject = reduceObject;
|
package/lib/reduceObject.d.cts
DELETED
|
@@ -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 };
|
package/lib/reduceObject.d.ts
DELETED
|
@@ -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 };
|
package/lib/reduceObject.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// ../object/src/entriesOf.ts
|
|
5
|
-
function entriesOf(obj) {
|
|
6
|
-
return Object.entries(obj);
|
|
7
|
-
}
|
|
8
|
-
__name(entriesOf, "entriesOf");
|
|
9
|
-
|
|
10
|
-
// src/reduceObject.ts
|
|
11
|
-
function reduceObject(object, reducer, initial) {
|
|
12
|
-
let accumulator = initial;
|
|
13
|
-
for (const [key, value] of entriesOf(object)) {
|
|
14
|
-
accumulator = reducer(accumulator, value, key);
|
|
15
|
-
}
|
|
16
|
-
return accumulator;
|
|
17
|
-
}
|
|
18
|
-
__name(reduceObject, "reduceObject");
|
|
19
|
-
|
|
20
|
-
export { reduceObject };
|
package/lib/reduceSet.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
// src/reduceSet.ts
|
|
7
|
-
function reduceSet(set, reducer, initial) {
|
|
8
|
-
let accumulator = initial;
|
|
9
|
-
for (const value of set) {
|
|
10
|
-
accumulator = reducer(accumulator, value);
|
|
11
|
-
}
|
|
12
|
-
return accumulator;
|
|
13
|
-
}
|
|
14
|
-
__name(reduceSet, "reduceSet");
|
|
15
|
-
|
|
16
|
-
exports.reduceSet = reduceSet;
|
package/lib/reduceSet.d.cts
DELETED
|
@@ -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.d.ts
DELETED
|
@@ -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,14 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/reduceSet.ts
|
|
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
|
-
export { reduceSet };
|
package/lib/toObjectIterable.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
// src/toObjectIterable.ts
|
|
7
|
-
function toObjectIterable(mapLike) {
|
|
8
|
-
const object = {};
|
|
9
|
-
for (const [key, value] of mapLike) {
|
|
10
|
-
if (typeof key !== "string" && typeof key !== "number" && typeof key !== "symbol") {
|
|
11
|
-
object[String(key)] = value;
|
|
12
|
-
} else {
|
|
13
|
-
object[key] = value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return object;
|
|
17
|
-
}
|
|
18
|
-
__name(toObjectIterable, "toObjectIterable");
|
|
19
|
-
|
|
20
|
-
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 };
|
package/lib/toObjectIterable.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/toObjectIterable.ts
|
|
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
|
-
export { toObjectIterable };
|