@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.
- package/lib/index.cjs +327 -234
- package/lib/index.d.cts +524 -33
- package/lib/index.d.ts +524 -33
- package/lib/index.js +295 -33
- package/package.json +152 -284
- package/lib/filterArray.cjs +0 -18
- package/lib/filterArray.d.cts +0 -18
- package/lib/filterArray.d.ts +0 -18
- package/lib/filterArray.js +0 -16
- 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 -11
- 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 -9
- 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 -11
- 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 -11
- package/lib/filterMap.cjs +0 -16
- package/lib/filterMap.d.cts +0 -18
- package/lib/filterMap.d.ts +0 -18
- package/lib/filterMap.js +0 -14
- package/lib/filterObject.cjs +0 -18
- package/lib/filterObject.d.cts +0 -18
- package/lib/filterObject.d.ts +0 -18
- package/lib/filterObject.js +0 -15
- package/lib/filterSet.cjs +0 -16
- package/lib/filterSet.d.cts +0 -18
- package/lib/filterSet.d.ts +0 -18
- package/lib/filterSet.js +0 -14
- package/lib/forEachArray.cjs +0 -14
- package/lib/forEachArray.d.cts +0 -17
- package/lib/forEachArray.d.ts +0 -17
- package/lib/forEachArray.js +0 -12
- 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 -11
- 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 -11
- 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 -11
- 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 -11
- package/lib/forEachMap.cjs +0 -12
- package/lib/forEachMap.d.cts +0 -17
- package/lib/forEachMap.d.ts +0 -17
- package/lib/forEachMap.js +0 -10
- package/lib/forEachObject.cjs +0 -14
- package/lib/forEachObject.d.cts +0 -17
- package/lib/forEachObject.d.ts +0 -17
- package/lib/forEachObject.js +0 -11
- package/lib/forEachSet.cjs +0 -12
- package/lib/forEachSet.d.cts +0 -17
- package/lib/forEachSet.d.ts +0 -17
- package/lib/forEachSet.js +0 -10
- package/lib/mapArray.cjs +0 -16
- package/lib/mapArray.d.cts +0 -17
- package/lib/mapArray.d.ts +0 -17
- package/lib/mapArray.js +0 -14
- 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 -11
- 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 -9
- 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 -14
- 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 -14
- package/lib/mapMap.cjs +0 -14
- package/lib/mapMap.d.cts +0 -17
- package/lib/mapMap.d.ts +0 -17
- package/lib/mapMap.js +0 -12
- package/lib/mapObject.cjs +0 -16
- package/lib/mapObject.d.cts +0 -17
- package/lib/mapObject.d.ts +0 -17
- package/lib/mapObject.js +0 -13
- package/lib/mapSet.cjs +0 -14
- package/lib/mapSet.d.cts +0 -17
- package/lib/mapSet.d.ts +0 -17
- package/lib/mapSet.js +0 -12
- package/lib/reduceArray.cjs +0 -16
- package/lib/reduceArray.d.cts +0 -18
- package/lib/reduceArray.d.ts +0 -18
- package/lib/reduceArray.js +0 -14
- package/lib/reduceIterable.cjs +0 -14
- package/lib/reduceIterable.d.cts +0 -18
- package/lib/reduceIterable.d.ts +0 -18
- package/lib/reduceIterable.js +0 -12
- package/lib/reduceIterableEntries.cjs +0 -14
- package/lib/reduceIterableEntries.d.cts +0 -18
- package/lib/reduceIterableEntries.d.ts +0 -18
- package/lib/reduceIterableEntries.js +0 -12
- package/lib/reduceIterableKeys.cjs +0 -14
- package/lib/reduceIterableKeys.d.cts +0 -18
- package/lib/reduceIterableKeys.d.ts +0 -18
- package/lib/reduceIterableKeys.js +0 -12
- package/lib/reduceIterableValues.cjs +0 -14
- package/lib/reduceIterableValues.d.cts +0 -18
- package/lib/reduceIterableValues.d.ts +0 -18
- package/lib/reduceIterableValues.js +0 -12
- package/lib/reduceMap.cjs +0 -14
- package/lib/reduceMap.d.cts +0 -18
- package/lib/reduceMap.d.ts +0 -18
- package/lib/reduceMap.js +0 -12
- package/lib/reduceObject.cjs +0 -16
- package/lib/reduceObject.d.cts +0 -18
- package/lib/reduceObject.d.ts +0 -18
- package/lib/reduceObject.js +0 -13
- package/lib/reduceSet.cjs +0 -14
- package/lib/reduceSet.d.cts +0 -18
- package/lib/reduceSet.d.ts +0 -18
- package/lib/reduceSet.js +0 -12
- package/lib/toObjectIterable.cjs +0 -18
- package/lib/toObjectIterable.d.cts +0 -7
- package/lib/toObjectIterable.d.ts +0 -7
- package/lib/toObjectIterable.js +0 -16
package/lib/mapIterableKeys.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the keys in an iterable of key-value pairs using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to transform
|
|
5
|
-
* @param mapper - A function that transforms each key
|
|
6
|
-
* @returns An iterable containing entries with transformed keys
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const mapped = mapIterableKeys(entries, (key) => key.toUpperCase())
|
|
12
|
-
* // mapped: Iterable of [['A', 1], ['B', 2], ['C', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapIterableKeys<K, V, K2>(mapLike: Iterable<[K, V]>, mapper: (key: K, value: V) => K2): Iterable<[K2, V]>;
|
|
16
|
-
|
|
17
|
-
export { mapIterableKeys };
|
package/lib/mapIterableKeys.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
import { map } from 'iter-tools';
|
|
3
|
-
|
|
4
|
-
function mapIterableKeys(mapLike, mapper) {
|
|
5
|
-
return map(([k, v]) => {
|
|
6
|
-
return [
|
|
7
|
-
mapper(k, v),
|
|
8
|
-
v
|
|
9
|
-
];
|
|
10
|
-
}, mapLike);
|
|
11
|
-
}
|
|
12
|
-
__name(mapIterableKeys, "mapIterableKeys");
|
|
13
|
-
|
|
14
|
-
export { mapIterableKeys };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var iterTools = require('iter-tools');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
function mapIterableValues(mapLike, mapper) {
|
|
8
|
-
return iterTools.map(([k, v]) => {
|
|
9
|
-
return [
|
|
10
|
-
k,
|
|
11
|
-
mapper(v, k)
|
|
12
|
-
];
|
|
13
|
-
}, mapLike);
|
|
14
|
-
}
|
|
15
|
-
__name(mapIterableValues, "mapIterableValues");
|
|
16
|
-
|
|
17
|
-
exports.mapIterableValues = mapIterableValues;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in an iterable of key-value pairs using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns An iterable containing entries with transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const mapped = mapIterableValues(entries, (value) => value * 2)
|
|
12
|
-
* // mapped: Iterable of [['a', 2], ['b', 4], ['c', 6]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapIterableValues<K, V, V2>(mapLike: Iterable<[K, V]>, mapper: (value: V, key: K) => V2): Iterable<[K, V2]>;
|
|
16
|
-
|
|
17
|
-
export { mapIterableValues };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in an iterable of key-value pairs using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns An iterable containing entries with transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const mapped = mapIterableValues(entries, (value) => value * 2)
|
|
12
|
-
* // mapped: Iterable of [['a', 2], ['b', 4], ['c', 6]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapIterableValues<K, V, V2>(mapLike: Iterable<[K, V]>, mapper: (value: V, key: K) => V2): Iterable<[K, V2]>;
|
|
16
|
-
|
|
17
|
-
export { mapIterableValues };
|
package/lib/mapIterableValues.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
import { map } from 'iter-tools';
|
|
3
|
-
|
|
4
|
-
function mapIterableValues(mapLike, mapper) {
|
|
5
|
-
return map(([k, v]) => {
|
|
6
|
-
return [
|
|
7
|
-
k,
|
|
8
|
-
mapper(v, k)
|
|
9
|
-
];
|
|
10
|
-
}, mapLike);
|
|
11
|
-
}
|
|
12
|
-
__name(mapIterableValues, "mapIterableValues");
|
|
13
|
-
|
|
14
|
-
export { mapIterableValues };
|
package/lib/mapMap.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 mapMap(map, mapper) {
|
|
6
|
-
const result = /* @__PURE__ */ new Map();
|
|
7
|
-
for (const [key, value] of map) {
|
|
8
|
-
result.set(key, mapper(value, key));
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
__name(mapMap, "mapMap");
|
|
13
|
-
|
|
14
|
-
exports.mapMap = mapMap;
|
package/lib/mapMap.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in a Map using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param map - The Map to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new Map containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const map = new Map([['a', 1], ['b', 2], ['c', 3]])
|
|
11
|
-
* const doubled = mapMap(map, (value) => value * 2)
|
|
12
|
-
* // doubled: Map { 'a' => 2, 'b' => 4, 'c' => 6 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapMap<K, V, V2>(map: ReadonlyMap<K, V>, mapper: (value: V, key: K) => V2): Map<K, V2>;
|
|
16
|
-
|
|
17
|
-
export { mapMap };
|
package/lib/mapMap.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in a Map using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param map - The Map to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new Map containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const map = new Map([['a', 1], ['b', 2], ['c', 3]])
|
|
11
|
-
* const doubled = mapMap(map, (value) => value * 2)
|
|
12
|
-
* // doubled: Map { 'a' => 2, 'b' => 4, 'c' => 6 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapMap<K, V, V2>(map: ReadonlyMap<K, V>, mapper: (value: V, key: K) => V2): Map<K, V2>;
|
|
16
|
-
|
|
17
|
-
export { mapMap };
|
package/lib/mapMap.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function mapMap(map, mapper) {
|
|
4
|
-
const result = /* @__PURE__ */ new Map();
|
|
5
|
-
for (const [key, value] of map) {
|
|
6
|
-
result.set(key, mapper(value, key));
|
|
7
|
-
}
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
__name(mapMap, "mapMap");
|
|
11
|
-
|
|
12
|
-
export { mapMap };
|
package/lib/mapObject.cjs
DELETED
|
@@ -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 mapObject(object, mapper) {
|
|
8
|
-
const result = {};
|
|
9
|
-
for (const [key, value] of entriesOf.entriesOf(object)) {
|
|
10
|
-
result[key] = mapper(value, key);
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
__name(mapObject, "mapObject");
|
|
15
|
-
|
|
16
|
-
exports.mapObject = mapObject;
|
package/lib/mapObject.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in an object using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param object - The object to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new object containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const obj = { a: 1, b: 2, c: 3 }
|
|
11
|
-
* const doubled = mapObject(obj, (value) => value * 2)
|
|
12
|
-
* // doubled: { a: 2, b: 4, c: 6 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapObject<T extends Record<string, unknown>, R>(object: T, mapper: (value: T[keyof T], key: keyof T) => R): Record<keyof T, R>;
|
|
16
|
-
|
|
17
|
-
export { mapObject };
|
package/lib/mapObject.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform the values in an object using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param object - The object to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new object containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const obj = { a: 1, b: 2, c: 3 }
|
|
11
|
-
* const doubled = mapObject(obj, (value) => value * 2)
|
|
12
|
-
* // doubled: { a: 2, b: 4, c: 6 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapObject<T extends Record<string, unknown>, R>(object: T, mapper: (value: T[keyof T], key: keyof T) => R): Record<keyof T, R>;
|
|
16
|
-
|
|
17
|
-
export { mapObject };
|
package/lib/mapObject.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
import { entriesOf } from '@mono/object/entriesOf';
|
|
3
|
-
|
|
4
|
-
function mapObject(object, mapper) {
|
|
5
|
-
const result = {};
|
|
6
|
-
for (const [key, value] of entriesOf(object)) {
|
|
7
|
-
result[key] = mapper(value, key);
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
__name(mapObject, "mapObject");
|
|
12
|
-
|
|
13
|
-
export { mapObject };
|
package/lib/mapSet.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 mapSet(set, mapper) {
|
|
6
|
-
const result = /* @__PURE__ */ new Set();
|
|
7
|
-
for (const value of set) {
|
|
8
|
-
result.add(mapper(value));
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
__name(mapSet, "mapSet");
|
|
13
|
-
|
|
14
|
-
exports.mapSet = mapSet;
|
package/lib/mapSet.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform each value in a Set using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param set - The Set to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new Set containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const set = new Set([1, 2, 3, 4, 5])
|
|
11
|
-
* const doubled = mapSet(set, (n) => n * 2)
|
|
12
|
-
* // doubled: Set { 2, 4, 6, 8, 10 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapSet<V, R>(set: ReadonlySet<V>, mapper: (value: V) => R): Set<R>;
|
|
16
|
-
|
|
17
|
-
export { mapSet };
|
package/lib/mapSet.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform each value in a Set using a mapper function.
|
|
3
|
-
*
|
|
4
|
-
* @param set - The Set to transform
|
|
5
|
-
* @param mapper - A function that transforms each value
|
|
6
|
-
* @returns A new Set containing the transformed values
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const set = new Set([1, 2, 3, 4, 5])
|
|
11
|
-
* const doubled = mapSet(set, (n) => n * 2)
|
|
12
|
-
* // doubled: Set { 2, 4, 6, 8, 10 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function mapSet<V, R>(set: ReadonlySet<V>, mapper: (value: V) => R): Set<R>;
|
|
16
|
-
|
|
17
|
-
export { mapSet };
|
package/lib/mapSet.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function mapSet(set, mapper) {
|
|
4
|
-
const result = /* @__PURE__ */ new Set();
|
|
5
|
-
for (const value of set) {
|
|
6
|
-
result.add(mapper(value));
|
|
7
|
-
}
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
__name(mapSet, "mapSet");
|
|
11
|
-
|
|
12
|
-
export { mapSet };
|
package/lib/reduceArray.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
|
-
function reduceArray(array, reducer, initial) {
|
|
6
|
-
let accumulator = initial;
|
|
7
|
-
let index = 0;
|
|
8
|
-
for (const value of array) {
|
|
9
|
-
accumulator = reducer(accumulator, value, index);
|
|
10
|
-
index++;
|
|
11
|
-
}
|
|
12
|
-
return accumulator;
|
|
13
|
-
}
|
|
14
|
-
__name(reduceArray, "reduceArray");
|
|
15
|
-
|
|
16
|
-
exports.reduceArray = reduceArray;
|
package/lib/reduceArray.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an array to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array 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 numbers = [1, 2, 3, 4, 5]
|
|
12
|
-
* const sum = reduceArray(numbers, (acc, n) => acc + n, 0)
|
|
13
|
-
* // sum: 15
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceArray<V, R>(array: readonly V[], reducer: (accumulator: R, value: V, index: number) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceArray };
|
package/lib/reduceArray.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an array to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array 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 numbers = [1, 2, 3, 4, 5]
|
|
12
|
-
* const sum = reduceArray(numbers, (acc, n) => acc + n, 0)
|
|
13
|
-
* // sum: 15
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceArray<V, R>(array: readonly V[], reducer: (accumulator: R, value: V, index: number) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceArray };
|
package/lib/reduceArray.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function reduceArray(array, reducer, initial) {
|
|
4
|
-
let accumulator = initial;
|
|
5
|
-
let index = 0;
|
|
6
|
-
for (const value of array) {
|
|
7
|
-
accumulator = reducer(accumulator, value, index);
|
|
8
|
-
index++;
|
|
9
|
-
}
|
|
10
|
-
return accumulator;
|
|
11
|
-
}
|
|
12
|
-
__name(reduceArray, "reduceArray");
|
|
13
|
-
|
|
14
|
-
export { reduceArray };
|
package/lib/reduceIterable.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 reduceIterable(collection, reducer, initial) {
|
|
6
|
-
let accumulator = initial;
|
|
7
|
-
for (const value of collection) {
|
|
8
|
-
accumulator = reducer(accumulator, value);
|
|
9
|
-
}
|
|
10
|
-
return accumulator;
|
|
11
|
-
}
|
|
12
|
-
__name(reduceIterable, "reduceIterable");
|
|
13
|
-
|
|
14
|
-
exports.reduceIterable = reduceIterable;
|
package/lib/reduceIterable.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param collection - The iterable 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 numbers = [1, 2, 3, 4, 5]
|
|
12
|
-
* const sum = reduceIterable(numbers, (acc, n) => acc + n, 0)
|
|
13
|
-
* // sum: 15
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterable<T, R>(collection: Iterable<T>, reducer: (accumulator: R, value: T) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterable };
|
package/lib/reduceIterable.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param collection - The iterable 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 numbers = [1, 2, 3, 4, 5]
|
|
12
|
-
* const sum = reduceIterable(numbers, (acc, n) => acc + n, 0)
|
|
13
|
-
* // sum: 15
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterable<T, R>(collection: Iterable<T>, reducer: (accumulator: R, value: T) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterable };
|
package/lib/reduceIterable.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function reduceIterable(collection, reducer, initial) {
|
|
4
|
-
let accumulator = initial;
|
|
5
|
-
for (const value of collection) {
|
|
6
|
-
accumulator = reducer(accumulator, value);
|
|
7
|
-
}
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
__name(reduceIterable, "reduceIterable");
|
|
11
|
-
|
|
12
|
-
export { reduceIterable };
|
|
@@ -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 reduceIterableEntries(mapLike, reducer, initial) {
|
|
6
|
-
let accumulator = initial;
|
|
7
|
-
for (const entry of mapLike) {
|
|
8
|
-
accumulator = reducer(accumulator, entry);
|
|
9
|
-
}
|
|
10
|
-
return accumulator;
|
|
11
|
-
}
|
|
12
|
-
__name(reduceIterableEntries, "reduceIterableEntries");
|
|
13
|
-
|
|
14
|
-
exports.reduceIterableEntries = reduceIterableEntries;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to reduce
|
|
5
|
-
* @param reducer - A function that combines entries
|
|
6
|
-
* @param initial - The initial value for the reduction
|
|
7
|
-
* @returns The reduced value
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const sum = reduceIterableEntries(entries, (acc, [key, value]) => acc + value, 0)
|
|
13
|
-
* // sum: 6
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableEntries<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, entry: [K, V]) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableEntries };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries to a single value using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to reduce
|
|
5
|
-
* @param reducer - A function that combines entries
|
|
6
|
-
* @param initial - The initial value for the reduction
|
|
7
|
-
* @returns The reduced value
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const sum = reduceIterableEntries(entries, (acc, [key, value]) => acc + value, 0)
|
|
13
|
-
* // sum: 6
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableEntries<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, entry: [K, V]) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableEntries };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function reduceIterableEntries(mapLike, reducer, initial) {
|
|
4
|
-
let accumulator = initial;
|
|
5
|
-
for (const entry of mapLike) {
|
|
6
|
-
accumulator = reducer(accumulator, entry);
|
|
7
|
-
}
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
__name(reduceIterableEntries, "reduceIterableEntries");
|
|
11
|
-
|
|
12
|
-
export { reduceIterableEntries };
|
|
@@ -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 reduceIterableKeys(mapLike, reducer, initial) {
|
|
6
|
-
let accumulator = initial;
|
|
7
|
-
for (const [k, v] of mapLike) {
|
|
8
|
-
accumulator = reducer(accumulator, k, v);
|
|
9
|
-
}
|
|
10
|
-
return accumulator;
|
|
11
|
-
}
|
|
12
|
-
__name(reduceIterableKeys, "reduceIterableKeys");
|
|
13
|
-
|
|
14
|
-
exports.reduceIterableKeys = reduceIterableKeys;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries based on keys using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to reduce
|
|
5
|
-
* @param reducer - A function that combines keys
|
|
6
|
-
* @param initial - The initial value for the reduction
|
|
7
|
-
* @returns The reduced value
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const keys = reduceIterableKeys(entries, (acc, key, value) => acc + key, '')
|
|
13
|
-
* // keys: 'abc'
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableKeys<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, key: K, value: V) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableKeys };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries based on keys using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to reduce
|
|
5
|
-
* @param reducer - A function that combines keys
|
|
6
|
-
* @param initial - The initial value for the reduction
|
|
7
|
-
* @returns The reduced value
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const keys = reduceIterableKeys(entries, (acc, key, value) => acc + key, '')
|
|
13
|
-
* // keys: 'abc'
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableKeys<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, key: K, value: V) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableKeys };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function reduceIterableKeys(mapLike, reducer, initial) {
|
|
4
|
-
let accumulator = initial;
|
|
5
|
-
for (const [k, v] of mapLike) {
|
|
6
|
-
accumulator = reducer(accumulator, k, v);
|
|
7
|
-
}
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
__name(reduceIterableKeys, "reduceIterableKeys");
|
|
11
|
-
|
|
12
|
-
export { reduceIterableKeys };
|
|
@@ -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 reduceIterableValues(mapLike, reducer, initial) {
|
|
6
|
-
let accumulator = initial;
|
|
7
|
-
for (const [k, v] of mapLike) {
|
|
8
|
-
accumulator = reducer(accumulator, v, k);
|
|
9
|
-
}
|
|
10
|
-
return accumulator;
|
|
11
|
-
}
|
|
12
|
-
__name(reduceIterableValues, "reduceIterableValues");
|
|
13
|
-
|
|
14
|
-
exports.reduceIterableValues = reduceIterableValues;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries based on values using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples 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 entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const sum = reduceIterableValues(entries, (acc, value, key) => acc + value, 0)
|
|
13
|
-
* // sum: 6
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableValues<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, value: V, key: K) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableValues };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce an iterable of key-value entries based on values using a reducer function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples 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 entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
12
|
-
* const sum = reduceIterableValues(entries, (acc, value, key) => acc + value, 0)
|
|
13
|
-
* // sum: 6
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function reduceIterableValues<K, V, R>(mapLike: Iterable<[K, V]>, reducer: (accumulator: R, value: V, key: K) => R, initial: R): R;
|
|
17
|
-
|
|
18
|
-
export { reduceIterableValues };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
-
|
|
3
|
-
function reduceIterableValues(mapLike, reducer, initial) {
|
|
4
|
-
let accumulator = initial;
|
|
5
|
-
for (const [k, v] of mapLike) {
|
|
6
|
-
accumulator = reducer(accumulator, v, k);
|
|
7
|
-
}
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
__name(reduceIterableValues, "reduceIterableValues");
|
|
11
|
-
|
|
12
|
-
export { reduceIterableValues };
|