@valkyriestudios/utils 12.2.0 → 12.2.1

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/array/dedupe.js CHANGED
@@ -1,13 +1,18 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fnv1A_1 = require("../hash/fnv1A");
3
4
  function dedupe(val) {
4
5
  if (!Array.isArray(val))
5
6
  return [];
6
7
  const set = new Set();
8
+ const acc = [];
7
9
  for (const item of val) {
8
- if (!set.has(item))
9
- set.add(item);
10
+ const hash = (0, fnv1A_1.default)(item);
11
+ if (set.has(hash))
12
+ continue;
13
+ set.add(hash);
14
+ acc.push(item);
10
15
  }
11
- return [...set];
16
+ return acc;
12
17
  }
13
18
  exports.default = dedupe;
package/array/sort.js CHANGED
@@ -43,7 +43,7 @@ function sort(arr, by, dir = 'asc', opts) {
43
43
  NOKEY_AT_END = false;
44
44
  if (typeof opts.filter_fn === 'function') {
45
45
  const fn = opts.filter_fn;
46
- FILTER_FN = el => (0, isNotEmpty_1.default)(el) && fn(el);
46
+ FILTER_FN = (el => (0, isNotEmpty_1.default)(el) && fn(el));
47
47
  }
48
48
  }
49
49
  const prepared_arr = [];
package/index.d.ts CHANGED
@@ -160,6 +160,9 @@ declare module "is" {
160
160
  }>;
161
161
  export default Is;
162
162
  }
163
+ declare module "hash/fnv1A" {
164
+ export default function fnv1A(data: unknown, offset?: number): number;
165
+ }
163
166
  declare module "array/dedupe" {
164
167
  export default function dedupe<T>(val: T[]): T[];
165
168
  }
@@ -294,9 +297,6 @@ declare module "function/noopreturn" {
294
297
  declare module "function/sleep" {
295
298
  export default function sleep(ms?: number): Promise<void>;
296
299
  }
297
- declare module "hash/fnv1A" {
298
- export default function fnv1A(data: unknown, offset?: number): number;
299
- }
300
300
  declare module "hash/guid" {
301
301
  export default function guid(): string;
302
302
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@valkyriestudios/utils", "version": "12.2.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "email": "contact@valkyriestudios.be", "url": "www.valkyriestudios.be" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
1
+ { "name": "@valkyriestudios/utils", "version": "12.2.1", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "email": "contact@valkyriestudios.be", "url": "www.valkyriestudios.be" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }