@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.
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getUnique = void 0;
7
7
  exports.getUniqueBy = getUniqueBy;
8
- const getUnique = e => [...new Set(e)];
8
+ const getUnique = n => [...new Set(n)];
9
9
  exports.getUnique = getUnique;
10
- function getUniqueBy(e, r) {
11
- const t = new Map();
12
- for (const n of e) {
13
- const o = r(n);
14
- t.has(o) || t.set(o, n);
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 [...t.values()];
16
+ return [...e.values()];
17
17
  }
@@ -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: (item: T) => U): T[];
22
+ export declare function getUniqueBy<T, U>(arr: readonly T[], mapper?: (item: T) => U): T[];
@@ -1 +1 @@
1
- export const getUnique=e=>[...new Set(e)];export function getUniqueBy(e,r){const t=new Map;for(const n of e){const o=r(n);t.has(o)||t.set(o,n)}return[...t.values()]}
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.1",
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.0",
15
- "@stryke/type-checks": "^0.3.6",
16
- "@stryke/types": "^0.8.6"
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": "366390ec25211fb6b36feed4bf0cffb7713253cb"
444
+ "gitHead": "7aac00edc2ff843fb756d37cdcaf482e2da4472b"
445
445
  }