@bemoje/iter 1.2.1 → 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 +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 +152 -284
- 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/filterArray.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/filterArray.ts
|
|
7
|
-
function filterArray(array, predicate) {
|
|
8
|
-
let index = 0;
|
|
9
|
-
const result = [];
|
|
10
|
-
for (const value of array) {
|
|
11
|
-
if (predicate(value, index)) {
|
|
12
|
-
result.push(value);
|
|
13
|
-
}
|
|
14
|
-
index++;
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
__name(filterArray, "filterArray");
|
|
19
|
-
|
|
20
|
-
exports.filterArray = filterArray;
|
package/lib/filterArray.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an array based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array to filter
|
|
5
|
-
* @param predicate - A function that tests each element. Returns `true` to keep the element, `false` otherwise.
|
|
6
|
-
* @returns A new array containing only the elements that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
11
|
-
* const evens = filterArray(numbers, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: [2, 4]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterArray<V, S extends V>(array: readonly V[], predicate: (value: V, index: number) => value is S): S[];
|
|
16
|
-
declare function filterArray<V>(array: readonly V[], predicate: (value: V, index: number) => boolean): V[];
|
|
17
|
-
|
|
18
|
-
export { filterArray };
|
package/lib/filterArray.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an array based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array to filter
|
|
5
|
-
* @param predicate - A function that tests each element. Returns `true` to keep the element, `false` otherwise.
|
|
6
|
-
* @returns A new array containing only the elements that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
11
|
-
* const evens = filterArray(numbers, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: [2, 4]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterArray<V, S extends V>(array: readonly V[], predicate: (value: V, index: number) => value is S): S[];
|
|
16
|
-
declare function filterArray<V>(array: readonly V[], predicate: (value: V, index: number) => boolean): V[];
|
|
17
|
-
|
|
18
|
-
export { filterArray };
|
package/lib/filterArray.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/filterArray.ts
|
|
5
|
-
function filterArray(array, predicate) {
|
|
6
|
-
let index = 0;
|
|
7
|
-
const result = [];
|
|
8
|
-
for (const value of array) {
|
|
9
|
-
if (predicate(value, index)) {
|
|
10
|
-
result.push(value);
|
|
11
|
-
}
|
|
12
|
-
index++;
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
__name(filterArray, "filterArray");
|
|
17
|
-
|
|
18
|
-
export { filterArray };
|
package/lib/filterIterable.cjs
DELETED
|
@@ -1,14 +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 filterIterable(collection, predicate) {
|
|
8
|
-
return iterTools.filter((value) => {
|
|
9
|
-
return predicate(value);
|
|
10
|
-
}, collection);
|
|
11
|
-
}
|
|
12
|
-
__name(filterIterable, "filterIterable");
|
|
13
|
-
|
|
14
|
-
exports.filterIterable = filterIterable;
|
package/lib/filterIterable.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param collection - The iterable to filter
|
|
5
|
-
* @param predicate - A function that tests each element. Returns `true` to keep the element, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the elements that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
11
|
-
* const evens = filterIterable(numbers, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: Iterable of [2, 4]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterable<T, S extends T>(collection: Iterable<T>, predicate: (value: T) => value is S): Iterable<S>;
|
|
16
|
-
declare function filterIterable<T>(collection: Iterable<T>, predicate: (value: T) => boolean): Iterable<T>;
|
|
17
|
-
|
|
18
|
-
export { filterIterable };
|
package/lib/filterIterable.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param collection - The iterable to filter
|
|
5
|
-
* @param predicate - A function that tests each element. Returns `true` to keep the element, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the elements that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
11
|
-
* const evens = filterIterable(numbers, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: Iterable of [2, 4]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterable<T, S extends T>(collection: Iterable<T>, predicate: (value: T) => value is S): Iterable<S>;
|
|
16
|
-
declare function filterIterable<T>(collection: Iterable<T>, predicate: (value: T) => boolean): Iterable<T>;
|
|
17
|
-
|
|
18
|
-
export { filterIterable };
|
package/lib/filterIterable.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { filter } from 'iter-tools';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function filterIterable(collection, predicate) {
|
|
6
|
-
return filter((value) => {
|
|
7
|
-
return predicate(value);
|
|
8
|
-
}, collection);
|
|
9
|
-
}
|
|
10
|
-
__name(filterIterable, "filterIterable");
|
|
11
|
-
|
|
12
|
-
export { filterIterable };
|
|
@@ -1,12 +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 filterIterableEntries(mapLike, predicate) {
|
|
8
|
-
return iterTools.filter(predicate, mapLike);
|
|
9
|
-
}
|
|
10
|
-
__name(filterIterableEntries, "filterIterableEntries");
|
|
11
|
-
|
|
12
|
-
exports.filterIterableEntries = filterIterableEntries;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each entry. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const filtered = filterIterableEntries(entries, ([key, value]) => value > 1)
|
|
12
|
-
* // filtered: Iterable of [['b', 2], ['c', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableEntries<K, V, K2 extends K, V2 extends V>(mapLike: Iterable<[K, V]>, predicate: (entry: [K, V]) => entry is [K2, V2]): Iterable<[K2, V2]>;
|
|
16
|
-
declare function filterIterableEntries<K, V>(mapLike: Iterable<[K, V]>, predicate: (entry: [K, V]) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableEntries };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each entry. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const filtered = filterIterableEntries(entries, ([key, value]) => value > 1)
|
|
12
|
-
* // filtered: Iterable of [['b', 2], ['c', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableEntries<K, V, K2 extends K, V2 extends V>(mapLike: Iterable<[K, V]>, predicate: (entry: [K, V]) => entry is [K2, V2]): Iterable<[K2, V2]>;
|
|
16
|
-
declare function filterIterableEntries<K, V>(mapLike: Iterable<[K, V]>, predicate: (entry: [K, V]) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableEntries };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { filter } from 'iter-tools';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function filterIterableEntries(mapLike, predicate) {
|
|
6
|
-
return filter(predicate, mapLike);
|
|
7
|
-
}
|
|
8
|
-
__name(filterIterableEntries, "filterIterableEntries");
|
|
9
|
-
|
|
10
|
-
export { filterIterableEntries };
|
|
@@ -1,14 +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 filterIterableKeys(mapLike, predicate) {
|
|
8
|
-
return iterTools.filter(([k, v]) => {
|
|
9
|
-
return predicate(k, v);
|
|
10
|
-
}, mapLike);
|
|
11
|
-
}
|
|
12
|
-
__name(filterIterableKeys, "filterIterableKeys");
|
|
13
|
-
|
|
14
|
-
exports.filterIterableKeys = filterIterableKeys;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function that tests keys.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each key-value pair. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries whose keys satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['apple', 1], ['banana', 2], ['apricot', 3]]
|
|
11
|
-
* const filtered = filterIterableKeys(entries, (key) => key.startsWith('a'))
|
|
12
|
-
* // filtered: Iterable of [['apple', 1], ['apricot', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableKeys<K, V, K2 extends K>(mapLike: Iterable<[K, V]>, predicate: (key: K, value: V) => key is K2): Iterable<[K2, V]>;
|
|
16
|
-
declare function filterIterableKeys<K, V>(mapLike: Iterable<[K, V]>, predicate: (key: K, value: V) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableKeys };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function that tests keys.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each key-value pair. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries whose keys satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['apple', 1], ['banana', 2], ['apricot', 3]]
|
|
11
|
-
* const filtered = filterIterableKeys(entries, (key) => key.startsWith('a'))
|
|
12
|
-
* // filtered: Iterable of [['apple', 1], ['apricot', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableKeys<K, V, K2 extends K>(mapLike: Iterable<[K, V]>, predicate: (key: K, value: V) => key is K2): Iterable<[K2, V]>;
|
|
16
|
-
declare function filterIterableKeys<K, V>(mapLike: Iterable<[K, V]>, predicate: (key: K, value: V) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableKeys };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { filter } from 'iter-tools';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function filterIterableKeys(mapLike, predicate) {
|
|
6
|
-
return filter(([k, v]) => {
|
|
7
|
-
return predicate(k, v);
|
|
8
|
-
}, mapLike);
|
|
9
|
-
}
|
|
10
|
-
__name(filterIterableKeys, "filterIterableKeys");
|
|
11
|
-
|
|
12
|
-
export { filterIterableKeys };
|
|
@@ -1,14 +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 filterIterableValues(mapLike, predicate) {
|
|
8
|
-
return iterTools.filter(([k, v]) => {
|
|
9
|
-
return predicate(v, k);
|
|
10
|
-
}, mapLike);
|
|
11
|
-
}
|
|
12
|
-
__name(filterIterableValues, "filterIterableValues");
|
|
13
|
-
|
|
14
|
-
exports.filterIterableValues = filterIterableValues;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function that tests values.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each value. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries whose values satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const filtered = filterIterableValues(entries, (value) => value > 1)
|
|
12
|
-
* // filtered: Iterable of [['b', 2], ['c', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableValues<K, V, V2 extends V>(mapLike: Iterable<[K, V]>, predicate: (value: V, key: K) => value is V2): Iterable<[K, V2]>;
|
|
16
|
-
declare function filterIterableValues<K, V>(mapLike: Iterable<[K, V]>, predicate: (value: V, key: K) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableValues };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an iterable of key-value entries based on a predicate function that tests values.
|
|
3
|
-
*
|
|
4
|
-
* @param mapLike - An iterable of key-value tuples to filter
|
|
5
|
-
* @param predicate - A function that tests each value. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns An iterable containing only the entries whose values satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
|
|
11
|
-
* const filtered = filterIterableValues(entries, (value) => value > 1)
|
|
12
|
-
* // filtered: Iterable of [['b', 2], ['c', 3]]
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterIterableValues<K, V, V2 extends V>(mapLike: Iterable<[K, V]>, predicate: (value: V, key: K) => value is V2): Iterable<[K, V2]>;
|
|
16
|
-
declare function filterIterableValues<K, V>(mapLike: Iterable<[K, V]>, predicate: (value: V, key: K) => boolean): Iterable<[K, V]>;
|
|
17
|
-
|
|
18
|
-
export { filterIterableValues };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { filter } from 'iter-tools';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function filterIterableValues(mapLike, predicate) {
|
|
6
|
-
return filter(([k, v]) => {
|
|
7
|
-
return predicate(v, k);
|
|
8
|
-
}, mapLike);
|
|
9
|
-
}
|
|
10
|
-
__name(filterIterableValues, "filterIterableValues");
|
|
11
|
-
|
|
12
|
-
export { filterIterableValues };
|
package/lib/filterMap.cjs
DELETED
|
@@ -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
|
-
|
|
6
|
-
// src/filterMap.ts
|
|
7
|
-
function filterMap(map, predicate) {
|
|
8
|
-
const result = /* @__PURE__ */ new Map();
|
|
9
|
-
for (const [key, value] of map) {
|
|
10
|
-
if (predicate(value, key)) {
|
|
11
|
-
result.set(key, value);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
__name(filterMap, "filterMap");
|
|
17
|
-
|
|
18
|
-
exports.filterMap = filterMap;
|
package/lib/filterMap.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter a Map based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param map - The Map to filter
|
|
5
|
-
* @param predicate - A function that tests each value-key pair. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns A new Map containing only the entries that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const map = new Map([['a', 1], ['b', 2], ['c', 3]])
|
|
11
|
-
* const filtered = filterMap(map, (value) => value > 1)
|
|
12
|
-
* // filtered: Map { 'b' => 2, 'c' => 3 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterMap<K, V, V2 extends V>(map: ReadonlyMap<K, V>, predicate: (value: V, key: K) => value is V2): Map<K, V2>;
|
|
16
|
-
declare function filterMap<K, V>(map: ReadonlyMap<K, V>, predicate: (value: V, key: K) => boolean): Map<K, V>;
|
|
17
|
-
|
|
18
|
-
export { filterMap };
|
package/lib/filterMap.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter a Map based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param map - The Map to filter
|
|
5
|
-
* @param predicate - A function that tests each value-key pair. Returns `true` to keep the entry, `false` otherwise.
|
|
6
|
-
* @returns A new Map containing only the entries that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const map = new Map([['a', 1], ['b', 2], ['c', 3]])
|
|
11
|
-
* const filtered = filterMap(map, (value) => value > 1)
|
|
12
|
-
* // filtered: Map { 'b' => 2, 'c' => 3 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterMap<K, V, V2 extends V>(map: ReadonlyMap<K, V>, predicate: (value: V, key: K) => value is V2): Map<K, V2>;
|
|
16
|
-
declare function filterMap<K, V>(map: ReadonlyMap<K, V>, predicate: (value: V, key: K) => boolean): Map<K, V>;
|
|
17
|
-
|
|
18
|
-
export { filterMap };
|
package/lib/filterMap.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/filterMap.ts
|
|
5
|
-
function filterMap(map, predicate) {
|
|
6
|
-
const result = /* @__PURE__ */ new Map();
|
|
7
|
-
for (const [key, value] of map) {
|
|
8
|
-
if (predicate(value, key)) {
|
|
9
|
-
result.set(key, value);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
__name(filterMap, "filterMap");
|
|
15
|
-
|
|
16
|
-
export { filterMap };
|
package/lib/filterObject.cjs
DELETED
|
@@ -1,24 +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/filterObject.ts
|
|
13
|
-
function filterObject(object, predicate) {
|
|
14
|
-
const result = {};
|
|
15
|
-
for (const [key, value] of entriesOf(object)) {
|
|
16
|
-
if (predicate(value, key)) {
|
|
17
|
-
result[key] = value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
__name(filterObject, "filterObject");
|
|
23
|
-
|
|
24
|
-
exports.filterObject = filterObject;
|
package/lib/filterObject.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an object's properties based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param object - The object to filter
|
|
5
|
-
* @param predicate - A function that tests each value-key pair. Returns `true` to keep the property, `false` otherwise.
|
|
6
|
-
* @returns A new object containing only the properties that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const obj = { a: 1, b: 2, c: 3 }
|
|
11
|
-
* const filtered = filterObject(obj, (value) => value > 1)
|
|
12
|
-
* // filtered: { b: 2, c: 3 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterObject<T extends Record<string, unknown>, V2 extends T[keyof T]>(object: T, predicate: (value: T[keyof T], key: keyof T) => value is V2): Partial<Record<keyof T, V2>>;
|
|
16
|
-
declare function filterObject<T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
|
|
17
|
-
|
|
18
|
-
export { filterObject };
|
package/lib/filterObject.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter an object's properties based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param object - The object to filter
|
|
5
|
-
* @param predicate - A function that tests each value-key pair. Returns `true` to keep the property, `false` otherwise.
|
|
6
|
-
* @returns A new object containing only the properties that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const obj = { a: 1, b: 2, c: 3 }
|
|
11
|
-
* const filtered = filterObject(obj, (value) => value > 1)
|
|
12
|
-
* // filtered: { b: 2, c: 3 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterObject<T extends Record<string, unknown>, V2 extends T[keyof T]>(object: T, predicate: (value: T[keyof T], key: keyof T) => value is V2): Partial<Record<keyof T, V2>>;
|
|
16
|
-
declare function filterObject<T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
|
|
17
|
-
|
|
18
|
-
export { filterObject };
|
package/lib/filterObject.js
DELETED
|
@@ -1,22 +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/filterObject.ts
|
|
11
|
-
function filterObject(object, predicate) {
|
|
12
|
-
const result = {};
|
|
13
|
-
for (const [key, value] of entriesOf(object)) {
|
|
14
|
-
if (predicate(value, key)) {
|
|
15
|
-
result[key] = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
__name(filterObject, "filterObject");
|
|
21
|
-
|
|
22
|
-
export { filterObject };
|
package/lib/filterSet.cjs
DELETED
|
@@ -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
|
-
|
|
6
|
-
// src/filterSet.ts
|
|
7
|
-
function filterSet(set, predicate) {
|
|
8
|
-
const result = /* @__PURE__ */ new Set();
|
|
9
|
-
for (const value of set) {
|
|
10
|
-
if (predicate(value)) {
|
|
11
|
-
result.add(value);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
__name(filterSet, "filterSet");
|
|
17
|
-
|
|
18
|
-
exports.filterSet = filterSet;
|
package/lib/filterSet.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter a Set based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param set - The Set to filter
|
|
5
|
-
* @param predicate - A function that tests each value. Returns `true` to keep the value, `false` otherwise.
|
|
6
|
-
* @returns A new Set containing only the values that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const set = new Set([1, 2, 3, 4, 5])
|
|
11
|
-
* const evens = filterSet(set, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: Set { 2, 4 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterSet<V, S extends V>(set: ReadonlySet<V>, predicate: (value: V) => value is S): Set<S>;
|
|
16
|
-
declare function filterSet<V>(set: ReadonlySet<V>, predicate: (value: V) => boolean): Set<V>;
|
|
17
|
-
|
|
18
|
-
export { filterSet };
|
package/lib/filterSet.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filter a Set based on a predicate function.
|
|
3
|
-
*
|
|
4
|
-
* @param set - The Set to filter
|
|
5
|
-
* @param predicate - A function that tests each value. Returns `true` to keep the value, `false` otherwise.
|
|
6
|
-
* @returns A new Set containing only the values that satisfy the predicate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const set = new Set([1, 2, 3, 4, 5])
|
|
11
|
-
* const evens = filterSet(set, (n) => n % 2 === 0)
|
|
12
|
-
* // evens: Set { 2, 4 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function filterSet<V, S extends V>(set: ReadonlySet<V>, predicate: (value: V) => value is S): Set<S>;
|
|
16
|
-
declare function filterSet<V>(set: ReadonlySet<V>, predicate: (value: V) => boolean): Set<V>;
|
|
17
|
-
|
|
18
|
-
export { filterSet };
|
package/lib/filterSet.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/filterSet.ts
|
|
5
|
-
function filterSet(set, predicate) {
|
|
6
|
-
const result = /* @__PURE__ */ new Set();
|
|
7
|
-
for (const value of set) {
|
|
8
|
-
if (predicate(value)) {
|
|
9
|
-
result.add(value);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
__name(filterSet, "filterSet");
|
|
15
|
-
|
|
16
|
-
export { filterSet };
|
package/lib/forEachArray.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/forEachArray.ts
|
|
7
|
-
function forEachArray(array, callback) {
|
|
8
|
-
let index = 0;
|
|
9
|
-
for (const value of array) {
|
|
10
|
-
callback(value, index);
|
|
11
|
-
index++;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
__name(forEachArray, "forEachArray");
|
|
15
|
-
|
|
16
|
-
exports.forEachArray = forEachArray;
|
package/lib/forEachArray.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execute a callback function for each element in an array.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array to iterate over
|
|
5
|
-
* @param callback - A function to execute for each element
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
10
|
-
* forEachArray(numbers, (n, index) => {
|
|
11
|
-
* console.log(`Item ${index}: ${n}`)
|
|
12
|
-
* })
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function forEachArray<V>(array: readonly V[], callback: (value: V, index: number) => void): void;
|
|
16
|
-
|
|
17
|
-
export { forEachArray };
|
package/lib/forEachArray.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execute a callback function for each element in an array.
|
|
3
|
-
*
|
|
4
|
-
* @param array - The array to iterate over
|
|
5
|
-
* @param callback - A function to execute for each element
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const numbers = [1, 2, 3, 4, 5]
|
|
10
|
-
* forEachArray(numbers, (n, index) => {
|
|
11
|
-
* console.log(`Item ${index}: ${n}`)
|
|
12
|
-
* })
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function forEachArray<V>(array: readonly V[], callback: (value: V, index: number) => void): void;
|
|
16
|
-
|
|
17
|
-
export { forEachArray };
|
package/lib/forEachArray.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/forEachArray.ts
|
|
5
|
-
function forEachArray(array, callback) {
|
|
6
|
-
let index = 0;
|
|
7
|
-
for (const value of array) {
|
|
8
|
-
callback(value, index);
|
|
9
|
-
index++;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
__name(forEachArray, "forEachArray");
|
|
13
|
-
|
|
14
|
-
export { forEachArray };
|