@stryke/helpers 0.5.0 → 0.5.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/dist/index.cjs CHANGED
@@ -36,17 +36,6 @@ Object.keys(_deepClone).forEach(function (key) {
36
36
  }
37
37
  });
38
38
  });
39
- var _deepCopy = require("./deep-copy.cjs");
40
- Object.keys(_deepCopy).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _deepCopy[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _deepCopy[key];
47
- }
48
- });
49
- });
50
39
  var _deepMerge = require("./deep-merge.cjs");
51
40
  Object.keys(_deepMerge).forEach(function (key) {
52
41
  if (key === "default" || key === "__esModule") return;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./arg-identity";
2
2
  export * from "./debounce";
3
3
  export * from "./deep-clone";
4
- export * from "./deep-copy";
5
4
  export * from "./deep-merge";
6
5
  export * from "./delay";
7
6
  export * from "./filter-empty";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export*from"./arg-identity";export*from"./debounce";export*from"./deep-clone";export*from"./deep-copy";export*from"./deep-merge";export*from"./delay";export*from"./filter-empty";export*from"./flatten-object";export*from"./get-field";export*from"./get-ordered-by";export*from"./get-unique";export*from"./identity";export*from"./is-equal";export*from"./match-sorter";export*from"./mutex";export*from"./noop";export*from"./remove-accents";export*from"./remove-empty-items";export*from"./semaphore";export*from"./set-field";export*from"./throttle";export*from"./timeout";export*from"./to-deep-key";export*from"./to-path";export*from"./unflatten-object";export*from"./union";export*from"./with-timeout";
1
+ export*from"./arg-identity";export*from"./debounce";export*from"./deep-clone";export*from"./deep-merge";export*from"./delay";export*from"./filter-empty";export*from"./flatten-object";export*from"./get-field";export*from"./get-ordered-by";export*from"./get-unique";export*from"./identity";export*from"./is-equal";export*from"./match-sorter";export*from"./mutex";export*from"./noop";export*from"./remove-accents";export*from"./remove-empty-items";export*from"./semaphore";export*from"./set-field";export*from"./throttle";export*from"./timeout";export*from"./to-deep-key";export*from"./to-path";export*from"./unflatten-object";export*from"./union";export*from"./with-timeout";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/helpers",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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": {
@@ -376,20 +376,6 @@
376
376
  "default": "./dist/deep-merge.mjs"
377
377
  }
378
378
  },
379
- "./deep-copy": {
380
- "import": {
381
- "types": "./dist/deep-copy.d.ts",
382
- "default": "./dist/deep-copy.mjs"
383
- },
384
- "require": {
385
- "types": "./dist/deep-copy.d.ts",
386
- "default": "./dist/deep-copy.cjs"
387
- },
388
- "default": {
389
- "types": "./dist/deep-copy.d.ts",
390
- "default": "./dist/deep-copy.mjs"
391
- }
392
- },
393
379
  "./deep-clone": {
394
380
  "import": {
395
381
  "types": "./dist/deep-clone.d.ts",
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deepCopy = deepCopy;
7
- function A(r) {
8
- const t = new ArrayBuffer(r.byteLength);
9
- return new Uint8Array(t).set(new Uint8Array(r)), t;
10
- }
11
- function C(r) {
12
- const t = A(r.buffer);
13
- return new DataView(t, r.byteOffset, r.byteLength);
14
- }
15
- function g(r) {
16
- return new Date(r.getTime());
17
- }
18
- function d(r) {
19
- const t = new Map();
20
- for (const [n, o] of r.entries()) t.set(deepCopy(n), deepCopy(o));
21
- return t;
22
- }
23
- const u = {
24
- "[object Float32Array]": Float32Array,
25
- "[object Float64Array]": Float64Array,
26
- "[object Int8Array]": Int8Array,
27
- "[object Int16Array]": Int16Array,
28
- "[object Int32Array]": Int32Array,
29
- "[object Uint8Array]": Uint8Array,
30
- "[object Uint16Array]": Uint16Array,
31
- "[object Uint32Array]": Uint32Array,
32
- "[object Uint8ClampedArray]": Uint8ClampedArray
33
- },
34
- j = {
35
- "[object Date]": g,
36
- "[object ArrayBuffer]": A,
37
- "[object DataView]": C,
38
- "[object Float32Array]": e,
39
- "[object Float64Array]": e,
40
- "[object Int8Array]": e,
41
- "[object Int16Array]": e,
42
- "[object Int32Array]": e,
43
- "[object Uint8Array]": e,
44
- "[object Uint8ClampedArray]": e,
45
- "[object Uint16Array]": e,
46
- "[object Uint32Array]": e,
47
- "[object BigInt64Array]": e,
48
- "[object BigUint64Array]": e,
49
- "[object RegExp]": cloneRegExp,
50
- "[object Map]": d
51
- };
52
- function e(r) {
53
- try {
54
- u["[object BigInt64Array]"] = BigInt64Array, u["[object BigUint64Array]"] = BigUint64Array;
55
- } catch {}
56
- const t = A(r.buffer),
57
- n = u[Object.prototype.toString.call(r)];
58
- if (!n) throw new Error("Unsupported typed array type in `cloneTypedArray`.");
59
- return new n(t).subarray(r.byteOffset, r.byteOffset + r.length);
60
- }
61
- function f(r, t, n, o, y) {
62
- const a = detectType(r),
63
- i = copy(r, a);
64
- if (!isCollection(a)) return i;
65
- const b = getKeys(r, a);
66
- for (const s of b) {
67
- const c = getValue(r, s, a);
68
- if (o.has(c)) setValue(t, s, n.get(c), a);else {
69
- const p = detectType(c),
70
- l = copy(c, p);
71
- isCollection(p) && (n.set(c, l), o.add(c)), setValue(t, s, f(c, l, n, o, y), a);
72
- }
73
- }
74
- return t;
75
- }
76
- function deepCopy(r, t) {
77
- const {
78
- customizer: n = null
79
- } = t ?? {},
80
- o = detectType(r);
81
- if (!isCollection(o)) return copy(r, o, n);
82
- const y = copy(r, o, n),
83
- a = new WeakMap([[r, y]]),
84
- i = new WeakSet([r]);
85
- return f(r, y, a, i, n);
86
- }
@@ -1,11 +0,0 @@
1
- export interface Options {
2
- customizer?: Customizer;
3
- }
4
- /**
5
- * Deep copy value
6
- *
7
- * @param value - The value to copy.
8
- * @param options - The options object.
9
- * @returns Returns the copied value.
10
- */
11
- export declare function deepCopy<T extends Record<string, any>>(value: T, options?: Options): T;
@@ -1 +0,0 @@
1
- function A(r){const t=new ArrayBuffer(r.byteLength);return new Uint8Array(t).set(new Uint8Array(r)),t}function C(r){const t=A(r.buffer);return new DataView(t,r.byteOffset,r.byteLength)}function g(r){return new Date(r.getTime())}function d(r){const t=new Map;for(const[n,o]of r.entries())t.set(deepCopy(n),deepCopy(o));return t}const u={"[object Float32Array]":Float32Array,"[object Float64Array]":Float64Array,"[object Int8Array]":Int8Array,"[object Int16Array]":Int16Array,"[object Int32Array]":Int32Array,"[object Uint8Array]":Uint8Array,"[object Uint16Array]":Uint16Array,"[object Uint32Array]":Uint32Array,"[object Uint8ClampedArray]":Uint8ClampedArray},j={"[object Date]":g,"[object ArrayBuffer]":A,"[object DataView]":C,"[object Float32Array]":e,"[object Float64Array]":e,"[object Int8Array]":e,"[object Int16Array]":e,"[object Int32Array]":e,"[object Uint8Array]":e,"[object Uint8ClampedArray]":e,"[object Uint16Array]":e,"[object Uint32Array]":e,"[object BigInt64Array]":e,"[object BigUint64Array]":e,"[object RegExp]":cloneRegExp,"[object Map]":d};function e(r){try{u["[object BigInt64Array]"]=BigInt64Array,u["[object BigUint64Array]"]=BigUint64Array}catch{}const t=A(r.buffer),n=u[Object.prototype.toString.call(r)];if(!n)throw new Error("Unsupported typed array type in `cloneTypedArray`.");return new n(t).subarray(r.byteOffset,r.byteOffset+r.length)}function f(r,t,n,o,y){const a=detectType(r),i=copy(r,a);if(!isCollection(a))return i;const b=getKeys(r,a);for(const s of b){const c=getValue(r,s,a);if(o.has(c))setValue(t,s,n.get(c),a);else{const p=detectType(c),l=copy(c,p);isCollection(p)&&(n.set(c,l),o.add(c)),setValue(t,s,f(c,l,n,o,y),a)}}return t}export function deepCopy(r,t){const{customizer:n=null}=t??{},o=detectType(r);if(!isCollection(o))return copy(r,o,n);const y=copy(r,o,n),a=new WeakMap([[r,y]]),i=new WeakSet([r]);return f(r,y,a,i,n)}