@stryke/helpers 0.7.1 → 0.7.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/dist/get-unique.cjs +7 -7
- package/dist/get-unique.d.ts +1 -1
- package/dist/get-unique.mjs +1 -1
- package/package.json +5 -5
package/dist/get-unique.cjs
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getUnique = void 0;
|
|
7
7
|
exports.getUniqueBy = getUniqueBy;
|
|
8
|
-
const getUnique =
|
|
8
|
+
const getUnique = n => [...new Set(n)];
|
|
9
9
|
exports.getUnique = getUnique;
|
|
10
|
-
function getUniqueBy(
|
|
11
|
-
const
|
|
12
|
-
for (const
|
|
13
|
-
const o =
|
|
14
|
-
|
|
10
|
+
function getUniqueBy(n, s = e => e) {
|
|
11
|
+
const e = new Map();
|
|
12
|
+
for (const t of n) {
|
|
13
|
+
const o = s(t);
|
|
14
|
+
e.has(o) || e.set(o, t);
|
|
15
15
|
}
|
|
16
|
-
return [...
|
|
16
|
+
return [...e.values()];
|
|
17
17
|
}
|
package/dist/get-unique.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export declare const getUnique: <T = any>(arr: T[]) => T[];
|
|
|
19
19
|
* @param mapper - The function used to convert the array elements.
|
|
20
20
|
* @returns A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
|
|
21
21
|
*/
|
|
22
|
-
export declare function getUniqueBy<T, U>(arr: readonly T[], mapper
|
|
22
|
+
export declare function getUniqueBy<T, U>(arr: readonly T[], mapper?: (item: T) => U): T[];
|
package/dist/get-unique.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const getUnique=
|
|
1
|
+
export const getUnique=n=>[...new Set(n)];export function getUniqueBy(n,s=e=>e){const e=new Map;for(const t of n){const o=s(t);e.has(o)||e.set(o,t)}return[...e.values()]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/helpers",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing miscellaneous helper functions that are used across many different Storm Software projects.",
|
|
6
6
|
"repository": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"private": false,
|
|
12
12
|
"publishConfig": { "access": "public" },
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@stryke/convert": "^0.3.
|
|
15
|
-
"@stryke/type-checks": "^0.3.
|
|
16
|
-
"@stryke/types": "^0.8.
|
|
14
|
+
"@stryke/convert": "^0.3.1",
|
|
15
|
+
"@stryke/type-checks": "^0.3.8",
|
|
16
|
+
"@stryke/types": "^0.8.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {},
|
|
19
19
|
"sideEffects": false,
|
|
@@ -441,5 +441,5 @@
|
|
|
441
441
|
"main": "./dist/index.cjs",
|
|
442
442
|
"module": "./dist/index.mjs",
|
|
443
443
|
"types": "./dist/index.d.ts",
|
|
444
|
-
"gitHead": "
|
|
444
|
+
"gitHead": "7aac00edc2ff843fb756d37cdcaf482e2da4472b"
|
|
445
445
|
}
|