@telperion/js-utils 3.6.3 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/array/gather.cjs +60 -0
- package/array/gather.d.ts +48 -0
- package/array/gather.js +59 -0
- package/array/gather.js.map +1 -0
- package/array/index.cjs +1 -0
- package/array/index.d.ts +1 -0
- package/array/index.js +1 -0
- package/array/index.js.map +1 -1
- package/array/proto/gather.cjs +6 -0
- package/array/proto/gather.d.ts +32 -0
- package/array/proto/gather.js +6 -0
- package/array/proto/gather.js.map +1 -0
- package/index.cjs +2 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +17 -2
package/README.md
CHANGED
|
@@ -82,6 +82,25 @@ const array = [{a: 1}, {a: 2}, {a: 3}];
|
|
|
82
82
|
findByKey(array, "a", 2); // {a: 2}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
#### [Gather](https://open-source.telperion.tr/js-utils/modules/_array_gather_.html)
|
|
86
|
+
Groups array items by a specified key into a Map
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { gather } from "@telperion/js-utils/array";
|
|
90
|
+
|
|
91
|
+
const users = [
|
|
92
|
+
{ role: "admin", name: "Alice" },
|
|
93
|
+
{ role: "user", name: "Bob" },
|
|
94
|
+
{ role: "admin", name: "Charlie" },
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
const grouped = gather(users, "role");
|
|
98
|
+
// Map {
|
|
99
|
+
// "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
100
|
+
// "user" => [{ role: "user", name: "Bob" }]
|
|
101
|
+
// }
|
|
102
|
+
```
|
|
103
|
+
|
|
85
104
|
#### [Intersection](https://open-source.telperion.tr/js-utils/modules/_array_intersection_.html)
|
|
86
105
|
Gets the intersection of the two arrays or sets
|
|
87
106
|
|
package/array/gather.cjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gather = gather;
|
|
4
|
+
/**
|
|
5
|
+
* #### Groups array items by a specified key into a Map
|
|
6
|
+
*
|
|
7
|
+
* Iterates over the array and groups items that share the same value for the given key.
|
|
8
|
+
* Returns a `Map` where each key is a unique value of the specified property and each value is an array of matching items.
|
|
9
|
+
*
|
|
10
|
+
* * * *
|
|
11
|
+
* Example usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { gather } from "@telperion/js-utils/array";
|
|
14
|
+
*
|
|
15
|
+
* const users = [
|
|
16
|
+
* { role: "admin", name: "Alice" },
|
|
17
|
+
* { role: "user", name: "Bob" },
|
|
18
|
+
* { role: "admin", name: "Charlie" },
|
|
19
|
+
* ];
|
|
20
|
+
*
|
|
21
|
+
* const grouped = gather(users, "role");
|
|
22
|
+
* // Map {
|
|
23
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
24
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
25
|
+
* // }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Example as Array Prototype:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import "@telperion/js-utils/array/proto/gather";
|
|
31
|
+
*
|
|
32
|
+
* const users = [
|
|
33
|
+
* { role: "admin", name: "Alice" },
|
|
34
|
+
* { role: "user", name: "Bob" },
|
|
35
|
+
* { role: "admin", name: "Charlie" },
|
|
36
|
+
* ];
|
|
37
|
+
*
|
|
38
|
+
* const grouped = users.gather("role");
|
|
39
|
+
* // Map {
|
|
40
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
41
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
42
|
+
* // }
|
|
43
|
+
* ```
|
|
44
|
+
* * * *
|
|
45
|
+
* @param array Array of objects to group
|
|
46
|
+
* @param key Key to group items by
|
|
47
|
+
* @typeparam T Type of array items
|
|
48
|
+
* @typeparam P Key type
|
|
49
|
+
* @returns A Map grouping items by the specified key's value
|
|
50
|
+
*/
|
|
51
|
+
function gather(array, key) {
|
|
52
|
+
return array.reduce((acc, item) => {
|
|
53
|
+
const groupKey = item[key];
|
|
54
|
+
if (!acc.has(groupKey)) {
|
|
55
|
+
acc.set(groupKey, []);
|
|
56
|
+
}
|
|
57
|
+
acc.get(groupKey).push(item);
|
|
58
|
+
return acc;
|
|
59
|
+
}, new Map());
|
|
60
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Groups array items by a specified key into a Map
|
|
3
|
+
*
|
|
4
|
+
* Iterates over the array and groups items that share the same value for the given key.
|
|
5
|
+
* Returns a `Map` where each key is a unique value of the specified property and each value is an array of matching items.
|
|
6
|
+
*
|
|
7
|
+
* * * *
|
|
8
|
+
* Example usage:
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { gather } from "@telperion/js-utils/array";
|
|
11
|
+
*
|
|
12
|
+
* const users = [
|
|
13
|
+
* { role: "admin", name: "Alice" },
|
|
14
|
+
* { role: "user", name: "Bob" },
|
|
15
|
+
* { role: "admin", name: "Charlie" },
|
|
16
|
+
* ];
|
|
17
|
+
*
|
|
18
|
+
* const grouped = gather(users, "role");
|
|
19
|
+
* // Map {
|
|
20
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
21
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
22
|
+
* // }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Example as Array Prototype:
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import "@telperion/js-utils/array/proto/gather";
|
|
28
|
+
*
|
|
29
|
+
* const users = [
|
|
30
|
+
* { role: "admin", name: "Alice" },
|
|
31
|
+
* { role: "user", name: "Bob" },
|
|
32
|
+
* { role: "admin", name: "Charlie" },
|
|
33
|
+
* ];
|
|
34
|
+
*
|
|
35
|
+
* const grouped = users.gather("role");
|
|
36
|
+
* // Map {
|
|
37
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
38
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
39
|
+
* // }
|
|
40
|
+
* ```
|
|
41
|
+
* * * *
|
|
42
|
+
* @param array Array of objects to group
|
|
43
|
+
* @param key Key to group items by
|
|
44
|
+
* @typeparam T Type of array items
|
|
45
|
+
* @typeparam P Key type
|
|
46
|
+
* @returns A Map grouping items by the specified key's value
|
|
47
|
+
*/
|
|
48
|
+
export declare function gather<T extends Record<any, any>, P extends keyof T>(array: T[], key: P): Map<T[P], T[]>;
|
package/array/gather.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #### Groups array items by a specified key into a Map
|
|
3
|
+
*
|
|
4
|
+
* Iterates over the array and groups items that share the same value for the given key.
|
|
5
|
+
* Returns a `Map` where each key is a unique value of the specified property and each value is an array of matching items.
|
|
6
|
+
*
|
|
7
|
+
* * * *
|
|
8
|
+
* Example usage:
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { gather } from "@telperion/js-utils/array";
|
|
11
|
+
*
|
|
12
|
+
* const users = [
|
|
13
|
+
* { role: "admin", name: "Alice" },
|
|
14
|
+
* { role: "user", name: "Bob" },
|
|
15
|
+
* { role: "admin", name: "Charlie" },
|
|
16
|
+
* ];
|
|
17
|
+
*
|
|
18
|
+
* const grouped = gather(users, "role");
|
|
19
|
+
* // Map {
|
|
20
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
21
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
22
|
+
* // }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Example as Array Prototype:
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import "@telperion/js-utils/array/proto/gather";
|
|
28
|
+
*
|
|
29
|
+
* const users = [
|
|
30
|
+
* { role: "admin", name: "Alice" },
|
|
31
|
+
* { role: "user", name: "Bob" },
|
|
32
|
+
* { role: "admin", name: "Charlie" },
|
|
33
|
+
* ];
|
|
34
|
+
*
|
|
35
|
+
* const grouped = users.gather("role");
|
|
36
|
+
* // Map {
|
|
37
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
38
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
39
|
+
* // }
|
|
40
|
+
* ```
|
|
41
|
+
* * * *
|
|
42
|
+
* @param array Array of objects to group
|
|
43
|
+
* @param key Key to group items by
|
|
44
|
+
* @typeparam T Type of array items
|
|
45
|
+
* @typeparam P Key type
|
|
46
|
+
* @returns A Map grouping items by the specified key's value
|
|
47
|
+
*/
|
|
48
|
+
export function gather(array, key) {
|
|
49
|
+
return array.reduce((acc, item) => {
|
|
50
|
+
const groupKey = item[key];
|
|
51
|
+
if (!acc.has(groupKey)) {
|
|
52
|
+
acc.set(groupKey, []);
|
|
53
|
+
}
|
|
54
|
+
acc.get(groupKey).push(item);
|
|
55
|
+
return acc;
|
|
56
|
+
}, new Map());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=gather.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/js-utils/src/array/gather.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,MAAM,CAAgD,KAAU,EAAE,GAAM;IACtF,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAE3B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxB,CAAC;QAED,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,IAAI,GAAG,EAAa,CAAC,CAAC;AAC3B,CAAC","file":"gather.js","sourcesContent":["/**\r\n * #### Groups array items by a specified key into a Map\r\n *\r\n * Iterates over the array and groups items that share the same value for the given key.\r\n * Returns a `Map` where each key is a unique value of the specified property and each value is an array of matching items.\r\n *\r\n * * * *\r\n * Example usage:\r\n * ```typescript\r\n * import { gather } from \"@telperion/js-utils/array\";\r\n *\r\n * const users = [\r\n * { role: \"admin\", name: \"Alice\" },\r\n * { role: \"user\", name: \"Bob\" },\r\n * { role: \"admin\", name: \"Charlie\" },\r\n * ];\r\n *\r\n * const grouped = gather(users, \"role\");\r\n * // Map {\r\n * // \"admin\" => [{ role: \"admin\", name: \"Alice\" }, { role: \"admin\", name: \"Charlie\" }],\r\n * // \"user\" => [{ role: \"user\", name: \"Bob\" }]\r\n * // }\r\n * ```\r\n *\r\n * Example as Array Prototype:\r\n * ```typescript\r\n * import \"@telperion/js-utils/array/proto/gather\";\r\n *\r\n * const users = [\r\n * { role: \"admin\", name: \"Alice\" },\r\n * { role: \"user\", name: \"Bob\" },\r\n * { role: \"admin\", name: \"Charlie\" },\r\n * ];\r\n *\r\n * const grouped = users.gather(\"role\");\r\n * // Map {\r\n * // \"admin\" => [{ role: \"admin\", name: \"Alice\" }, { role: \"admin\", name: \"Charlie\" }],\r\n * // \"user\" => [{ role: \"user\", name: \"Bob\" }]\r\n * // }\r\n * ```\r\n * * * *\r\n * @param array Array of objects to group\r\n * @param key Key to group items by\r\n * @typeparam T Type of array items\r\n * @typeparam P Key type\r\n * @returns A Map grouping items by the specified key's value\r\n */\r\nexport function gather<T extends Record<any, any>, P extends keyof T>(array: T[], key: P) {\r\n return array.reduce((acc, item) => {\r\n const groupKey = item[key];\r\n\r\n if (!acc.has(groupKey)) {\r\n acc.set(groupKey, []);\r\n }\r\n\r\n acc.get(groupKey)!.push(item);\r\n\r\n return acc;\r\n }, new Map<T[P], T[]>());\r\n}\r\n"]}
|
package/array/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("@telperion/js-utils/array/async-map"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("@telperion/js-utils/array/compact"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("@telperion/js-utils/array/difference"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("@telperion/js-utils/array/find-by-key"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("@telperion/js-utils/array/gather"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("@telperion/js-utils/array/intersection"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("@telperion/js-utils/array/limit"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("@telperion/js-utils/array/remove"), exports);
|
package/array/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from '@telperion/js-utils/array/async-map';
|
|
|
3
3
|
export * from '@telperion/js-utils/array/compact';
|
|
4
4
|
export * from '@telperion/js-utils/array/difference';
|
|
5
5
|
export * from '@telperion/js-utils/array/find-by-key';
|
|
6
|
+
export * from '@telperion/js-utils/array/gather';
|
|
6
7
|
export * from '@telperion/js-utils/array/intersection';
|
|
7
8
|
export * from '@telperion/js-utils/array/limit';
|
|
8
9
|
export * from '@telperion/js-utils/array/remove';
|
package/array/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from '@telperion/js-utils/array/async-map';
|
|
|
3
3
|
export * from '@telperion/js-utils/array/compact';
|
|
4
4
|
export * from '@telperion/js-utils/array/difference';
|
|
5
5
|
export * from '@telperion/js-utils/array/find-by-key';
|
|
6
|
+
export * from '@telperion/js-utils/array/gather';
|
|
6
7
|
export * from '@telperion/js-utils/array/intersection';
|
|
7
8
|
export * from '@telperion/js-utils/array/limit';
|
|
8
9
|
export * from '@telperion/js-utils/array/remove';
|
package/array/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/js-utils/src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC","file":"index.js","sourcesContent":["export * from '@telperion/js-utils/array/arrayize';\nexport * from '@telperion/js-utils/array/async-map';\nexport * from '@telperion/js-utils/array/compact';\nexport * from '@telperion/js-utils/array/difference';\nexport * from '@telperion/js-utils/array/find-by-key';\nexport * from '@telperion/js-utils/array/intersection';\nexport * from '@telperion/js-utils/array/limit';\nexport * from '@telperion/js-utils/array/remove';\nexport * from '@telperion/js-utils/array/replace';\nexport * from '@telperion/js-utils/array/uniquify';\nexport * from '@telperion/js-utils/array/uniquify-by-key';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/js-utils/src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC","file":"index.js","sourcesContent":["export * from '@telperion/js-utils/array/arrayize';\nexport * from '@telperion/js-utils/array/async-map';\nexport * from '@telperion/js-utils/array/compact';\nexport * from '@telperion/js-utils/array/difference';\nexport * from '@telperion/js-utils/array/find-by-key';\nexport * from '@telperion/js-utils/array/gather';\nexport * from '@telperion/js-utils/array/intersection';\nexport * from '@telperion/js-utils/array/limit';\nexport * from '@telperion/js-utils/array/remove';\nexport * from '@telperion/js-utils/array/replace';\nexport * from '@telperion/js-utils/array/uniquify';\nexport * from '@telperion/js-utils/array/uniquify-by-key';\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export interface Array<T> {
|
|
3
|
+
/**
|
|
4
|
+
* #### Gather
|
|
5
|
+
*
|
|
6
|
+
* Groups array items by a specified key into a Map
|
|
7
|
+
*
|
|
8
|
+
* * * *
|
|
9
|
+
* Example:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import "@telperion/js-utils/array/proto/gather";
|
|
12
|
+
*
|
|
13
|
+
* const users = [
|
|
14
|
+
* { role: "admin", name: "Alice" },
|
|
15
|
+
* { role: "user", name: "Bob" },
|
|
16
|
+
* { role: "admin", name: "Charlie" },
|
|
17
|
+
* ];
|
|
18
|
+
*
|
|
19
|
+
* const grouped = users.gather("role");
|
|
20
|
+
* // Map {
|
|
21
|
+
* // "admin" => [{ role: "admin", name: "Alice" }, { role: "admin", name: "Charlie" }],
|
|
22
|
+
* // "user" => [{ role: "user", name: "Bob" }]
|
|
23
|
+
* // }
|
|
24
|
+
* ```
|
|
25
|
+
* * * *
|
|
26
|
+
* @param key Key to group items by
|
|
27
|
+
* @return A Map grouping items by the specified key's value
|
|
28
|
+
*/
|
|
29
|
+
gather<P extends keyof T>(key: P): Map<T[P], T[]>;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/js-utils/src/array/proto/gather.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAkC1D,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,UAAmE,GAAM;IAChG,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3B,CAAC,CAAC","file":"gather.js","sourcesContent":["import { gather } from '@telperion/js-utils/array/gather';\r\n\r\ndeclare global {\r\n export interface Array<T> {\r\n /**\r\n * #### Gather\r\n *\r\n * Groups array items by a specified key into a Map\r\n *\r\n * * * *\r\n * Example:\r\n * ```typescript\r\n * import \"@telperion/js-utils/array/proto/gather\";\r\n *\r\n * const users = [\r\n * { role: \"admin\", name: \"Alice\" },\r\n * { role: \"user\", name: \"Bob\" },\r\n * { role: \"admin\", name: \"Charlie\" },\r\n * ];\r\n *\r\n * const grouped = users.gather(\"role\");\r\n * // Map {\r\n * // \"admin\" => [{ role: \"admin\", name: \"Alice\" }, { role: \"admin\", name: \"Charlie\" }],\r\n * // \"user\" => [{ role: \"user\", name: \"Bob\" }]\r\n * // }\r\n * ```\r\n * * * *\r\n * @param key Key to group items by\r\n * @return A Map grouping items by the specified key's value\r\n */\r\n gather<P extends keyof T>(key: P): Map<T[P], T[]>;\r\n }\r\n}\r\n\r\nArray.prototype.gather = function<T extends Record<any, any>, P extends keyof T>(this: T[], key: P): Map<T[P], T[]> {\r\n return gather(this, key);\r\n};\r\n"]}
|
package/index.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.map = exports.deepFreeze = exports.deepest = exports.clone = exports.uniquifyByKey = exports.uniquify = exports.replace = exports.remove = exports.intersection = exports.findByKey = exports.difference = exports.asyncMap = exports.arrayize = void 0;
|
|
3
|
+
exports.map = exports.deepFreeze = exports.deepest = exports.clone = exports.uniquifyByKey = exports.uniquify = exports.replace = exports.remove = exports.intersection = exports.gather = exports.findByKey = exports.difference = exports.asyncMap = exports.arrayize = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var array_1 = require("@telperion/js-utils/array");
|
|
6
6
|
Object.defineProperty(exports, "arrayize", { enumerable: true, get: function () { return array_1.arrayize; } });
|
|
7
7
|
Object.defineProperty(exports, "asyncMap", { enumerable: true, get: function () { return array_1.asyncMap; } });
|
|
8
8
|
Object.defineProperty(exports, "difference", { enumerable: true, get: function () { return array_1.difference; } });
|
|
9
9
|
Object.defineProperty(exports, "findByKey", { enumerable: true, get: function () { return array_1.findByKey; } });
|
|
10
|
+
Object.defineProperty(exports, "gather", { enumerable: true, get: function () { return array_1.gather; } });
|
|
10
11
|
Object.defineProperty(exports, "intersection", { enumerable: true, get: function () { return array_1.intersection; } });
|
|
11
12
|
Object.defineProperty(exports, "remove", { enumerable: true, get: function () { return array_1.remove; } });
|
|
12
13
|
Object.defineProperty(exports, "replace", { enumerable: true, get: function () { return array_1.replace; } });
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ReplaceByMapOptions, ReplaceItemsOptions, Inclusion, Substraction, arrayize, asyncMap, difference, findByKey, intersection, remove, replace, uniquify, uniquifyByKey } from '@telperion/js-utils/array';
|
|
1
|
+
export { ReplaceByMapOptions, ReplaceItemsOptions, Inclusion, Substraction, arrayize, asyncMap, difference, findByKey, gather, intersection, remove, replace, uniquify, uniquifyByKey } from '@telperion/js-utils/array';
|
|
2
2
|
export * from '@telperion/js-utils/class';
|
|
3
3
|
export * from '@telperion/js-utils/function';
|
|
4
4
|
export * from '@telperion/js-utils/map';
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { arrayize, asyncMap, difference, findByKey, intersection, remove, replace, uniquify, uniquifyByKey } from '@telperion/js-utils/array';
|
|
1
|
+
export { arrayize, asyncMap, difference, findByKey, gather, intersection, remove, replace, uniquify, uniquifyByKey } from '@telperion/js-utils/array';
|
|
2
2
|
export * from '@telperion/js-utils/class';
|
|
3
3
|
export * from '@telperion/js-utils/function';
|
|
4
4
|
export * from '@telperion/js-utils/map';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/js-utils/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAC7E,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,iDAAiD;AAEjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC","file":"index.js","sourcesContent":["export {\n ReplaceByMapOptions,\n ReplaceItemsOptions,\n Inclusion,\n Substraction,\n arrayize,\n asyncMap,\n difference,\n findByKey,\n intersection,\n remove,\n replace,\n uniquify,\n uniquifyByKey\n} from '@telperion/js-utils/array';\nexport * from '@telperion/js-utils/class';\nexport * from '@telperion/js-utils/function';\nexport * from '@telperion/js-utils/map';\nexport * from '@telperion/js-utils/math';\nexport { clone, deepest, deepFreeze, map } from '@telperion/js-utils/object';\nexport * from '@telperion/js-utils/promise';\nexport * from '@telperion/js-utils/time';\n// export { } from '@telperion/js-utils/string';\n\nexport * from '@telperion/js-utils/compact';\nexport * from '@telperion/js-utils/is-falsy';\nexport * from '@telperion/js-utils/is-truthy';\nexport * from '@telperion/js-utils/open-promise';\nexport * from '@telperion/js-utils/smart-map';\nexport * from '@telperion/js-utils/unique-id';\nexport * from '@telperion/js-utils/limit';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/js-utils/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAC7E,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,iDAAiD;AAEjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC","file":"index.js","sourcesContent":["export {\n ReplaceByMapOptions,\n ReplaceItemsOptions,\n Inclusion,\n Substraction,\n arrayize,\n asyncMap,\n difference,\n findByKey,\n gather,\n intersection,\n remove,\n replace,\n uniquify,\n uniquifyByKey\n} from '@telperion/js-utils/array';\nexport * from '@telperion/js-utils/class';\nexport * from '@telperion/js-utils/function';\nexport * from '@telperion/js-utils/map';\nexport * from '@telperion/js-utils/math';\nexport { clone, deepest, deepFreeze, map } from '@telperion/js-utils/object';\nexport * from '@telperion/js-utils/promise';\nexport * from '@telperion/js-utils/time';\n// export { } from '@telperion/js-utils/string';\n\nexport * from '@telperion/js-utils/compact';\nexport * from '@telperion/js-utils/is-falsy';\nexport * from '@telperion/js-utils/is-truthy';\nexport * from '@telperion/js-utils/open-promise';\nexport * from '@telperion/js-utils/smart-map';\nexport * from '@telperion/js-utils/unique-id';\nexport * from '@telperion/js-utils/limit';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telperion/js-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Javascript utility functions for web development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"object",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"remove",
|
|
27
27
|
"deepest",
|
|
28
28
|
"never",
|
|
29
|
-
"arrayize"
|
|
29
|
+
"arrayize",
|
|
30
|
+
"gather"
|
|
30
31
|
],
|
|
31
32
|
"homepage": "https://open-source.telperion.tr/js-utils",
|
|
32
33
|
"repository": {
|
|
@@ -159,6 +160,13 @@
|
|
|
159
160
|
"require": "./array/proto/find-by-key.cjs",
|
|
160
161
|
"types": "./array/proto/find-by-key.d.ts"
|
|
161
162
|
},
|
|
163
|
+
"./array/proto/gather": {
|
|
164
|
+
"default": "./array/proto/gather.cjs",
|
|
165
|
+
"import": "./array/proto/gather.js",
|
|
166
|
+
"node": "./array/proto/gather.cjs",
|
|
167
|
+
"require": "./array/proto/gather.cjs",
|
|
168
|
+
"types": "./array/proto/gather.d.ts"
|
|
169
|
+
},
|
|
162
170
|
"./array/proto/intersection": {
|
|
163
171
|
"default": "./array/proto/intersection.cjs",
|
|
164
172
|
"import": "./array/proto/intersection.js",
|
|
@@ -243,6 +251,13 @@
|
|
|
243
251
|
"require": "./array/find-by-key.cjs",
|
|
244
252
|
"types": "./array/find-by-key.d.ts"
|
|
245
253
|
},
|
|
254
|
+
"./array/gather": {
|
|
255
|
+
"default": "./array/gather.cjs",
|
|
256
|
+
"import": "./array/gather.js",
|
|
257
|
+
"node": "./array/gather.cjs",
|
|
258
|
+
"require": "./array/gather.cjs",
|
|
259
|
+
"types": "./array/gather.d.ts"
|
|
260
|
+
},
|
|
246
261
|
"./array/intersection": {
|
|
247
262
|
"default": "./array/intersection.cjs",
|
|
248
263
|
"import": "./array/intersection.js",
|