@stryke/helpers 0.1.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.
Files changed (84) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +295 -0
  3. package/dist/arg-identity.cjs +9 -0
  4. package/dist/arg-identity.d.ts +10 -0
  5. package/dist/arg-identity.mjs +1 -0
  6. package/dist/debounce.cjs +24 -0
  7. package/dist/debounce.d.ts +41 -0
  8. package/dist/debounce.mjs +1 -0
  9. package/dist/deep-clone.cjs +61 -0
  10. package/dist/deep-clone.d.ts +63 -0
  11. package/dist/deep-clone.mjs +1 -0
  12. package/dist/deep-merge.cjs +35 -0
  13. package/dist/deep-merge.d.ts +12 -0
  14. package/dist/deep-merge.mjs +1 -0
  15. package/dist/delay.cjs +28 -0
  16. package/dist/delay.d.ts +72 -0
  17. package/dist/delay.mjs +1 -0
  18. package/dist/errors.cjs +18 -0
  19. package/dist/errors.d.ts +12 -0
  20. package/dist/errors.mjs +1 -0
  21. package/dist/flatten-object.cjs +20 -0
  22. package/dist/flatten-object.d.ts +33 -0
  23. package/dist/flatten-object.mjs +1 -0
  24. package/dist/get-field.cjs +41 -0
  25. package/dist/get-field.d.ts +251 -0
  26. package/dist/get-field.mjs +1 -0
  27. package/dist/get-ordered-by.cjs +18 -0
  28. package/dist/get-ordered-by.d.ts +36 -0
  29. package/dist/get-ordered-by.mjs +1 -0
  30. package/dist/get-unique.cjs +17 -0
  31. package/dist/get-unique.d.ts +22 -0
  32. package/dist/get-unique.mjs +1 -0
  33. package/dist/identity.cjs +9 -0
  34. package/dist/identity.d.ts +15 -0
  35. package/dist/identity.mjs +1 -0
  36. package/dist/index.cjs +280 -0
  37. package/dist/index.d.ts +25 -0
  38. package/dist/index.mjs +1 -0
  39. package/dist/is-equal.cjs +60 -0
  40. package/dist/is-equal.d.ts +18 -0
  41. package/dist/is-equal.mjs +1 -0
  42. package/dist/is-production.cjs +12 -0
  43. package/dist/is-production.d.ts +30 -0
  44. package/dist/is-production.mjs +1 -0
  45. package/dist/is-runtime-server.cjs +10 -0
  46. package/dist/is-runtime-server.d.ts +11 -0
  47. package/dist/is-runtime-server.mjs +1 -0
  48. package/dist/match-sorter.cjs +184 -0
  49. package/dist/match-sorter.d.ts +77 -0
  50. package/dist/match-sorter.mjs +1 -0
  51. package/dist/noop.cjs +10 -0
  52. package/dist/noop.d.ts +18 -0
  53. package/dist/noop.mjs +1 -0
  54. package/dist/remove-accents.cjs +411 -0
  55. package/dist/remove-accents.d.ts +8 -0
  56. package/dist/remove-accents.mjs +1 -0
  57. package/dist/remove-empty-items.cjs +8 -0
  58. package/dist/remove-empty-items.d.ts +7 -0
  59. package/dist/remove-empty-items.mjs +1 -0
  60. package/dist/set-field.cjs +20 -0
  61. package/dist/set-field.d.ts +10 -0
  62. package/dist/set-field.mjs +1 -0
  63. package/dist/throttle.cjs +13 -0
  64. package/dist/throttle.d.ts +28 -0
  65. package/dist/throttle.mjs +1 -0
  66. package/dist/timeout.cjs +11 -0
  67. package/dist/timeout.d.ts +8 -0
  68. package/dist/timeout.mjs +1 -0
  69. package/dist/to-deep-key.cjs +14 -0
  70. package/dist/to-deep-key.d.ts +35 -0
  71. package/dist/to-deep-key.mjs +1 -0
  72. package/dist/to-path.cjs +23 -0
  73. package/dist/to-path.d.ts +18 -0
  74. package/dist/to-path.mjs +1 -0
  75. package/dist/unflatten-object.cjs +10 -0
  76. package/dist/unflatten-object.d.ts +33 -0
  77. package/dist/unflatten-object.mjs +1 -0
  78. package/dist/union.cjs +10 -0
  79. package/dist/union.d.ts +20 -0
  80. package/dist/union.mjs +1 -0
  81. package/dist/with-timeout.cjs +10 -0
  82. package/dist/with-timeout.d.ts +20 -0
  83. package/dist/with-timeout.mjs +1 -0
  84. package/package.json +423 -0
@@ -0,0 +1,36 @@
1
+ type Order = "asc" | "desc";
2
+ /**
3
+ * Sorts an array of objects based on multiple properties and their corresponding order directions.
4
+ *
5
+ * @remarks
6
+ * This function takes an array of objects, an array of keys to sort by, and an array of order directions.
7
+ * It returns the sorted array, ordering by each key according to its corresponding direction
8
+ * ('asc' for ascending or 'desc' for descending). If values for a key are equal,
9
+ * it moves to the next key to determine the order.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Sort an array of objects by 'user' in ascending order and 'age' in descending order.
14
+ * const users = [
15
+ * { user: 'fred', age: 48 },
16
+ * { user: 'barney', age: 34 },
17
+ * { user: 'fred', age: 40 },
18
+ * { user: 'barney', age: 36 },
19
+ * ];
20
+ * const result = orderBy(users, ['user', 'age'], ['asc', 'desc']);
21
+ * // result will be:
22
+ * // [
23
+ * // { user: 'barney', age: 36 },
24
+ * // { user: 'barney', age: 34 },
25
+ * // { user: 'fred', age: 48 },
26
+ * // { user: 'fred', age: 40 },
27
+ * // ]
28
+ * ```
29
+ *
30
+ * @param collection - The array of objects to be sorted.
31
+ * @param keys - An array of keys (properties) by which to sort.
32
+ * @param orders - An array of order directions ('asc' for ascending or 'desc' for descending).
33
+ * @returns The sorted array.
34
+ */
35
+ export declare function getOrderedBy<T>(collection: T[], keys: (keyof T)[], orders: Order[]): T[];
36
+ export {};
@@ -0,0 +1 @@
1
+ export function getOrderedBy(f,n,o){const u=(r,e,t)=>r<e?t==="asc"?-1:1:r>e?t==="asc"?1:-1:0,T=n.map((r,e)=>o[e]??o.at(-1));return[...f].sort((r,e)=>{for(const[t,c]of n.entries()){const i=T[t],s=u(r[c],e[c],i);if(s!==0)return s}return 0})}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getUnique = void 0;
7
+ exports.getUniqueBy = getUniqueBy;
8
+ const getUnique = e => [...new Set(e)];
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);
15
+ }
16
+ return [...t.values()];
17
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns an array of unique values from the given array.
3
+ *
4
+ * @param arr - The array to get unique values from.
5
+ * @returns An array of unique values.
6
+ */
7
+ export declare const getUnique: <T = any>(arr: T[]) => T[];
8
+ /**
9
+ * Returns a new array containing only the unique elements from the original array,
10
+ * based on the values returned by the mapper function.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
15
+ * // [1.2, 2.1, 3.2, 5.7, 7.19]
16
+ * ```
17
+ *
18
+ * @param arr - The array to process.
19
+ * @param mapper - The function used to convert the array elements.
20
+ * @returns A new array containing only the unique elements from the original array, based on the values returned by the mapper function.
21
+ */
22
+ export declare function getUniqueBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[];
@@ -0,0 +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()]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.identity = identity;
7
+ function identity(t) {
8
+ return t;
9
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns the input value unchanged.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * identity(5); // Returns 5
7
+ * identity('hello'); // Returns 'hello'
8
+ * identity({ key: 'value' }); // Returns { key: 'value' }
9
+ * ```
10
+ *
11
+ * @template T - The type of the input value.
12
+ * @param x - The value to be returned.
13
+ * @returns The input value.
14
+ */
15
+ export declare function identity<T>(x: T): T;
@@ -0,0 +1 @@
1
+ export function identity(t){return t}
package/dist/index.cjs ADDED
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _argIdentity = require("./arg-identity.cjs");
7
+ Object.keys(_argIdentity).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _argIdentity[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _argIdentity[key];
14
+ }
15
+ });
16
+ });
17
+ var _debounce = require("./debounce.cjs");
18
+ Object.keys(_debounce).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _debounce[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _debounce[key];
25
+ }
26
+ });
27
+ });
28
+ var _deepClone = require("./deep-clone.cjs");
29
+ Object.keys(_deepClone).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _deepClone[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _deepClone[key];
36
+ }
37
+ });
38
+ });
39
+ var _deepMerge = require("./deep-merge.cjs");
40
+ Object.keys(_deepMerge).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _deepMerge[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _deepMerge[key];
47
+ }
48
+ });
49
+ });
50
+ var _delay = require("./delay.cjs");
51
+ Object.keys(_delay).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _delay[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _delay[key];
58
+ }
59
+ });
60
+ });
61
+ var _flattenObject = require("./flatten-object.cjs");
62
+ Object.keys(_flattenObject).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _flattenObject[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _flattenObject[key];
69
+ }
70
+ });
71
+ });
72
+ var _getField = require("./get-field.cjs");
73
+ Object.keys(_getField).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _getField[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _getField[key];
80
+ }
81
+ });
82
+ });
83
+ var _getOrderedBy = require("./get-ordered-by.cjs");
84
+ Object.keys(_getOrderedBy).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _getOrderedBy[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _getOrderedBy[key];
91
+ }
92
+ });
93
+ });
94
+ var _getUnique = require("./get-unique.cjs");
95
+ Object.keys(_getUnique).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _getUnique[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _getUnique[key];
102
+ }
103
+ });
104
+ });
105
+ var _identity = require("./identity.cjs");
106
+ Object.keys(_identity).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _identity[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function () {
112
+ return _identity[key];
113
+ }
114
+ });
115
+ });
116
+ var _isEqual = require("./is-equal.cjs");
117
+ Object.keys(_isEqual).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _isEqual[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _isEqual[key];
124
+ }
125
+ });
126
+ });
127
+ var _isProduction = require("./is-production.cjs");
128
+ Object.keys(_isProduction).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _isProduction[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _isProduction[key];
135
+ }
136
+ });
137
+ });
138
+ var _isRuntimeServer = require("./is-runtime-server.cjs");
139
+ Object.keys(_isRuntimeServer).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _isRuntimeServer[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _isRuntimeServer[key];
146
+ }
147
+ });
148
+ });
149
+ var _matchSorter = require("./match-sorter.cjs");
150
+ Object.keys(_matchSorter).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _matchSorter[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function () {
156
+ return _matchSorter[key];
157
+ }
158
+ });
159
+ });
160
+ var _noop = require("./noop.cjs");
161
+ Object.keys(_noop).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _noop[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function () {
167
+ return _noop[key];
168
+ }
169
+ });
170
+ });
171
+ var _removeAccents = require("./remove-accents.cjs");
172
+ Object.keys(_removeAccents).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (key in exports && exports[key] === _removeAccents[key]) return;
175
+ Object.defineProperty(exports, key, {
176
+ enumerable: true,
177
+ get: function () {
178
+ return _removeAccents[key];
179
+ }
180
+ });
181
+ });
182
+ var _removeEmptyItems = require("./remove-empty-items.cjs");
183
+ Object.keys(_removeEmptyItems).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _removeEmptyItems[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function () {
189
+ return _removeEmptyItems[key];
190
+ }
191
+ });
192
+ });
193
+ var _setField = require("./set-field.cjs");
194
+ Object.keys(_setField).forEach(function (key) {
195
+ if (key === "default" || key === "__esModule") return;
196
+ if (key in exports && exports[key] === _setField[key]) return;
197
+ Object.defineProperty(exports, key, {
198
+ enumerable: true,
199
+ get: function () {
200
+ return _setField[key];
201
+ }
202
+ });
203
+ });
204
+ var _throttle = require("./throttle.cjs");
205
+ Object.keys(_throttle).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (key in exports && exports[key] === _throttle[key]) return;
208
+ Object.defineProperty(exports, key, {
209
+ enumerable: true,
210
+ get: function () {
211
+ return _throttle[key];
212
+ }
213
+ });
214
+ });
215
+ var _timeout = require("./timeout.cjs");
216
+ Object.keys(_timeout).forEach(function (key) {
217
+ if (key === "default" || key === "__esModule") return;
218
+ if (key in exports && exports[key] === _timeout[key]) return;
219
+ Object.defineProperty(exports, key, {
220
+ enumerable: true,
221
+ get: function () {
222
+ return _timeout[key];
223
+ }
224
+ });
225
+ });
226
+ var _toDeepKey = require("./to-deep-key.cjs");
227
+ Object.keys(_toDeepKey).forEach(function (key) {
228
+ if (key === "default" || key === "__esModule") return;
229
+ if (key in exports && exports[key] === _toDeepKey[key]) return;
230
+ Object.defineProperty(exports, key, {
231
+ enumerable: true,
232
+ get: function () {
233
+ return _toDeepKey[key];
234
+ }
235
+ });
236
+ });
237
+ var _toPath = require("./to-path.cjs");
238
+ Object.keys(_toPath).forEach(function (key) {
239
+ if (key === "default" || key === "__esModule") return;
240
+ if (key in exports && exports[key] === _toPath[key]) return;
241
+ Object.defineProperty(exports, key, {
242
+ enumerable: true,
243
+ get: function () {
244
+ return _toPath[key];
245
+ }
246
+ });
247
+ });
248
+ var _unflattenObject = require("./unflatten-object.cjs");
249
+ Object.keys(_unflattenObject).forEach(function (key) {
250
+ if (key === "default" || key === "__esModule") return;
251
+ if (key in exports && exports[key] === _unflattenObject[key]) return;
252
+ Object.defineProperty(exports, key, {
253
+ enumerable: true,
254
+ get: function () {
255
+ return _unflattenObject[key];
256
+ }
257
+ });
258
+ });
259
+ var _union = require("./union.cjs");
260
+ Object.keys(_union).forEach(function (key) {
261
+ if (key === "default" || key === "__esModule") return;
262
+ if (key in exports && exports[key] === _union[key]) return;
263
+ Object.defineProperty(exports, key, {
264
+ enumerable: true,
265
+ get: function () {
266
+ return _union[key];
267
+ }
268
+ });
269
+ });
270
+ var _withTimeout = require("./with-timeout.cjs");
271
+ Object.keys(_withTimeout).forEach(function (key) {
272
+ if (key === "default" || key === "__esModule") return;
273
+ if (key in exports && exports[key] === _withTimeout[key]) return;
274
+ Object.defineProperty(exports, key, {
275
+ enumerable: true,
276
+ get: function () {
277
+ return _withTimeout[key];
278
+ }
279
+ });
280
+ });
@@ -0,0 +1,25 @@
1
+ export * from "./arg-identity";
2
+ export * from "./debounce";
3
+ export * from "./deep-clone";
4
+ export * from "./deep-merge";
5
+ export * from "./delay";
6
+ export * from "./flatten-object";
7
+ export * from "./get-field";
8
+ export * from "./get-ordered-by";
9
+ export * from "./get-unique";
10
+ export * from "./identity";
11
+ export * from "./is-equal";
12
+ export * from "./is-production";
13
+ export * from "./is-runtime-server";
14
+ export * from "./match-sorter";
15
+ export * from "./noop";
16
+ export * from "./remove-accents";
17
+ export * from "./remove-empty-items";
18
+ export * from "./set-field";
19
+ export * from "./throttle";
20
+ export * from "./timeout";
21
+ export * from "./to-deep-key";
22
+ export * from "./to-path";
23
+ export * from "./unflatten-object";
24
+ export * from "./union";
25
+ export * from "./with-timeout";
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export*from"./arg-identity";export*from"./debounce";export*from"./deep-clone";export*from"./deep-merge";export*from"./delay";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"./is-production";export*from"./is-runtime-server";export*from"./match-sorter";export*from"./noop";export*from"./remove-accents";export*from"./remove-empty-items";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";
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isEqual = isEqual;
7
+ var _types = require("@stryke/types");
8
+ const l = typeof Map == "function",
9
+ a = typeof Set == "function",
10
+ c = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
11
+ function o(e, t) {
12
+ if (e === t) return !0;
13
+ if (e && t && typeof e == "object" && typeof t == "object") {
14
+ if (e.constructor !== t.constructor) return !1;
15
+ let n;
16
+ if (Array.isArray(e)) {
17
+ if (n = e.length, n != t.length) return !1;
18
+ for (let r = n; r-- !== 0;) if (!o(e[r], t[r])) return !1;
19
+ return !0;
20
+ }
21
+ let i;
22
+ if (l && e instanceof Map && t instanceof Map) {
23
+ if (e.size !== t.size) return !1;
24
+ i = e.entries();
25
+ let r;
26
+ for (; !(r = i.next()).done;) if (!t.has(r.value[0])) return !1;
27
+ for (i = e.entries(); !(r = i.next()).done;) if (!o(r.value[1], t.get(r.value[0]))) return !1;
28
+ return !0;
29
+ }
30
+ if (a && e instanceof Set && t instanceof Set) {
31
+ if (e.size !== t.size) return !1;
32
+ i = e.entries();
33
+ let r;
34
+ for (; !(r = i.next()).done;) if (!t.has(r.value[0])) return !1;
35
+ return !0;
36
+ }
37
+ if (Array.isArray(e) && Array.isArray(t) && c && ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
38
+ if (n = e.length, n != t.length) return !1;
39
+ for (let r = n; r-- !== 0;) if (e[r] !== t[r]) return !1;
40
+ return !0;
41
+ }
42
+ if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
43
+ if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof t.valueOf == "function") return e.valueOf() === t.valueOf();
44
+ if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof t.toString == "function") return e.toString() === t.toString();
45
+ const f = Object.keys(e);
46
+ if (n = f.length, n !== Object.keys(t).length) return !1;
47
+ for (let r = n; r-- !== 0;) if (!(0, _types.isSet)(r) || !(0, _types.isSetString)(f[r]) || !Object.prototype.hasOwnProperty.call(t, f[r])) return !1;
48
+ for (let r = n; r-- !== 0;) if (!(Array.isArray(f) && (f[r] === "_owner" || f[r] === "__v" || f[r] === "__o") && e.$$typeof) && (!(0, _types.isSet)(r) || !(0, _types.isSetString)(f[r]) || !o(e[f[r]], t[f[r]]))) return !1;
49
+ return !0;
50
+ }
51
+ return e !== e && t !== t;
52
+ }
53
+ function isEqual(e, t) {
54
+ try {
55
+ return o(e, t);
56
+ } catch (n) {
57
+ if (/stack|recursion/i.test(n?.message || "")) return console.warn("isEqual cannot handle circular refs"), !1;
58
+ throw n;
59
+ }
60
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * isEqual(1, 1); // true
7
+ * isEqual({ a: 1 }, { a: 1 }); // true
8
+ * isEqual(/abc/g, /abc/g); // true
9
+ * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
10
+ * isEqual([1, 2, 3], [1, 2, 3]); // true
11
+ * isEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true
12
+ * ```
13
+ *
14
+ * @param a - The first value to compare.
15
+ * @param b - The second value to compare.
16
+ * @returns `true` if the values are equal, otherwise `false`.
17
+ */
18
+ export declare function isEqual(a: any, b: any): boolean;
@@ -0,0 +1 @@
1
+ import{isSet as s,isSetString as u}from"@stryke/types";const l=typeof Map=="function",a=typeof Set=="function",c=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let n;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(let r=n;r--!==0;)if(!o(e[r],t[r]))return!1;return!0}let i;if(l&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;i=e.entries();let r;for(;!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;for(i=e.entries();!(r=i.next()).done;)if(!o(r.value[1],t.get(r.value[0])))return!1;return!0}if(a&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;i=e.entries();let r;for(;!(r=i.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(Array.isArray(e)&&Array.isArray(t)&&c&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(let r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();const f=Object.keys(e);if(n=f.length,n!==Object.keys(t).length)return!1;for(let r=n;r--!==0;)if(!s(r)||!u(f[r])||!Object.prototype.hasOwnProperty.call(t,f[r]))return!1;for(let r=n;r--!==0;)if(!(Array.isArray(f)&&(f[r]==="_owner"||f[r]==="__v"||f[r]==="__o")&&e.$$typeof)&&(!s(r)||!u(f[r])||!o(e[f[r]],t[f[r]])))return!1;return!0}return e!==e&&t!==t}export function isEqual(e,t){try{return o(e,t)}catch(n){if(/stack|recursion/i.test(n?.message||""))return console.warn("isEqual cannot handle circular refs"),!1;throw n}}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isProduction = exports.isMode = exports.isDevelopment = void 0;
7
+ const isMode = (o, t) => t?.toLowerCase() === o,
8
+ isProduction = o => isMode("production", o),
9
+ isDevelopment = o => !isProduction(o);
10
+ exports.isDevelopment = isDevelopment;
11
+ exports.isProduction = isProduction;
12
+ exports.isMode = isMode;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Check the current runtime mode of the process
3
+ *
4
+ * @param mode - The mode to check the current process's mode against
5
+ * @param env - An optional environment name to check the current process's mode against
6
+ * @returns An indicator specifying if the current runtime matches the `mode` parameter
7
+ */
8
+ export declare const isMode: (mode: string, env: string) => boolean;
9
+ /**
10
+ * The function checks if the code is running in production.
11
+ *
12
+ * @param env - An environment name to check the current process's mode against
13
+ * @returns A boolean indicating if the code is running in production.
14
+ */
15
+ export declare const isProduction: (env: string) => boolean;
16
+ /**
17
+ * The function checks if the code is **NOT** running in production.
18
+ *
19
+ * @remarks
20
+ * **Please note:** This function does **not** check if the mode equals 'development' specifically.
21
+ *
22
+ * To check for the 'development' mode specifically, run:
23
+ *
24
+ * ```typescript
25
+ * const isDevelopmentSpecifically = isMode("development");
26
+ * ```
27
+ * @param env - An environment name to check the current process's mode against
28
+ * @returns A boolean indicating if the code is **NOT** running in production.
29
+ */
30
+ export declare const isDevelopment: (env: string) => boolean;
@@ -0,0 +1 @@
1
+ export const isMode=(o,t)=>t?.toLowerCase()===o,isProduction=o=>isMode("production",o),isDevelopment=o=>!isProduction(o);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isRuntimeServer = exports.isRuntimeClient = void 0;
7
+ const isRuntimeServer = () => typeof globalThis > "u" || "Deno" in globalThis,
8
+ isRuntimeClient = () => !isRuntimeServer();
9
+ exports.isRuntimeClient = isRuntimeClient;
10
+ exports.isRuntimeServer = isRuntimeServer;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The function checks if the code is running on the server-side
3
+ *
4
+ * @returns An indicator specifying if the code is running on the server-side
5
+ */
6
+ export declare const isRuntimeServer: () => boolean;
7
+ /**
8
+ * The function checks if the code is running in
9
+ * the browser (and not on the server).
10
+ */
11
+ export declare const isRuntimeClient: () => boolean;
@@ -0,0 +1 @@
1
+ export const isRuntimeServer=()=>typeof globalThis>"u"||"Deno"in globalThis,isRuntimeClient=()=>!isRuntimeServer();