@hyperfrontend/list-utils 0.0.4 → 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 (48) hide show
  1. package/CHANGELOG.md +24 -6
  2. package/README.md +7 -4
  3. package/SECURITY.md +50 -15
  4. package/_dependencies/@hyperfrontend/data-utils/index.cjs.js +214 -0
  5. package/_dependencies/@hyperfrontend/data-utils/index.esm.js +202 -0
  6. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js +7 -0
  7. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js +5 -0
  8. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +8 -0
  9. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +7 -0
  10. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
  11. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
  12. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js +6 -0
  13. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js +5 -0
  14. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +7 -0
  15. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +5 -0
  16. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +7 -0
  17. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +5 -0
  18. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js +6 -0
  19. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js +5 -0
  20. package/bundle/index.iife.js +10 -134
  21. package/bundle/index.iife.min.js +1 -2
  22. package/bundle/index.umd.js +10 -134
  23. package/bundle/index.umd.min.js +1 -2
  24. package/index.cjs.js +88 -122
  25. package/index.d.ts +172 -8
  26. package/index.d.ts.map +1 -1
  27. package/index.esm.js +76 -110
  28. package/package.json +12 -7
  29. package/bundle/index.iife.js.map +0 -1
  30. package/bundle/index.iife.min.js.map +0 -1
  31. package/bundle/index.umd.js.map +0 -1
  32. package/bundle/index.umd.min.js.map +0 -1
  33. package/create-fifo-list.d.ts +0 -18
  34. package/create-fifo-list.d.ts.map +0 -1
  35. package/create-lifo-list.d.ts +0 -18
  36. package/create-lifo-list.d.ts.map +0 -1
  37. package/create-range.d.ts +0 -9
  38. package/create-range.d.ts.map +0 -1
  39. package/create-value-picker.d.ts +0 -12
  40. package/create-value-picker.d.ts.map +0 -1
  41. package/get-last-key-in-map.d.ts +0 -2
  42. package/get-last-key-in-map.d.ts.map +0 -1
  43. package/index.cjs.js.map +0 -1
  44. package/index.esm.js.map +0 -1
  45. package/non-empty-strings.d.ts +0 -8
  46. package/non-empty-strings.d.ts.map +0 -1
  47. package/unique-strings.d.ts +0 -8
  48. package/unique-strings.d.ts.map +0 -1
@@ -0,0 +1,5 @@
1
+ const _Object = globalThis.Object;
2
+ const freeze = _Object.freeze;
3
+ const keys = _Object.keys;
4
+
5
+ export { freeze, keys };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const _Set = globalThis.Set;
4
+ const _Reflect = globalThis.Reflect;
5
+ const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []);
6
+ exports.createSet = createSet;
@@ -0,0 +1,5 @@
1
+ const _Set = globalThis.Set;
2
+ const _Reflect = globalThis.Reflect;
3
+ const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []);
4
+
5
+ export { createSet };
@@ -1,51 +1,19 @@
1
1
  var HyperfrontendListUtils = (function (exports) {
2
2
  'use strict';
3
3
 
4
- /**
5
- * Safe copies of Object built-in methods.
6
- *
7
- * These references are captured at module initialization time to protect against
8
- * prototype pollution attacks. Import only what you need for tree-shaking.
9
- *
10
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
11
- */
12
- // Capture references at module initialization time
4
+ const _Array = globalThis.Array;
5
+ const isArray = _Array.isArray;
6
+ const from = _Array.from;
7
+
8
+ const _Error = globalThis.Error;
9
+ const _Reflect$1 = globalThis.Reflect;
10
+ const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
11
+
13
12
  const _Object = globalThis.Object;
14
- /**
15
- * (Safe copy) Prevents modification of existing property attributes and values,
16
- * and prevents the addition of new properties.
17
- */
18
13
  const freeze = _Object.freeze;
19
14
 
20
15
  const registeredClasses = [];
21
16
 
22
- /**
23
- * Safe copies of Array built-in static methods.
24
- *
25
- * These references are captured at module initialization time to protect against
26
- * prototype pollution attacks. Import only what you need for tree-shaking.
27
- *
28
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/array
29
- */
30
- // Capture references at module initialization time
31
- const _Array = globalThis.Array;
32
- /**
33
- * (Safe copy) Determines whether the passed value is an Array.
34
- */
35
- const isArray = _Array.isArray;
36
- /**
37
- * (Safe copy) Creates an array from an array-like or iterable object.
38
- */
39
- const from = _Array.from;
40
-
41
- /**
42
- * Returns the data type of the target.
43
- * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
44
- * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
45
- *
46
- * @param target - The target to get the data type of.
47
- * @returns The data type of the target.
48
- */
49
17
  const getType = (target) => {
50
18
  if (target === null)
51
19
  return 'null';
@@ -61,67 +29,18 @@ var HyperfrontendListUtils = (function (exports) {
61
29
  return nativeDataType;
62
30
  };
63
31
 
64
- /**
65
- * Safe copies of Error built-ins via factory functions.
66
- *
67
- * Since constructors cannot be safely captured via Object.assign, this module
68
- * provides factory functions that use Reflect.construct internally.
69
- *
70
- * These references are captured at module initialization time to protect against
71
- * prototype pollution attacks. Import only what you need for tree-shaking.
72
- *
73
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
74
- */
75
- // Capture references at module initialization time
76
- const _Error = globalThis.Error;
77
- const _Reflect$1 = globalThis.Reflect;
78
- /**
79
- * (Safe copy) Creates a new Error using the captured Error constructor.
80
- * Use this instead of `new Error()`.
81
- *
82
- * @param message - Optional error message.
83
- * @param options - Optional error options.
84
- * @returns A new Error instance.
85
- */
86
- const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
87
-
88
- /**
89
- * Safe copies of Set built-in via factory function.
90
- *
91
- * Since constructors cannot be safely captured via Object.assign, this module
92
- * provides a factory function that uses Reflect.construct internally.
93
- *
94
- * These references are captured at module initialization time to protect against
95
- * prototype pollution attacks. Import only what you need for tree-shaking.
96
- *
97
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/set
98
- */
99
- // Capture references at module initialization time
100
32
  const _Set = globalThis.Set;
101
33
  const _Reflect = globalThis.Reflect;
102
- /**
103
- * (Safe copy) Creates a new Set using the captured Set constructor.
104
- * Use this instead of `new Set()`.
105
- *
106
- * @param iterable - Optional iterable of values.
107
- * @returns A new Set instance.
108
- */
109
34
  const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []);
110
35
 
111
- /**
112
- * Creates a FIFO (First-In-First-Out) list.
113
- *
114
- * @template T The type of elements in the list, must be an object.
115
- * @returns {FifoList<T>} A FIFO list with methods to manipulate and query the list.
116
- */
117
36
  function createFifoList() {
118
37
  const list = createSet();
119
38
  const push = (item) => {
120
39
  if (getType(item) !== 'object') {
121
- throw createError('A fifo list only non-primitive values');
40
+ throw createError('A fifo list only supports non-primitive values');
122
41
  }
123
42
  if (list.has(item)) {
124
- throw createError('Cannot a item that already exists');
43
+ throw createError('Cannot push an item that already exists in the list');
125
44
  }
126
45
  list.add(item);
127
46
  };
@@ -153,12 +72,6 @@ var HyperfrontendListUtils = (function (exports) {
153
72
  return freeze(result);
154
73
  }
155
74
 
156
- /**
157
- * Creates a LIFO (Last-In-First-Out) list.
158
- *
159
- * @template T The type of elements in the list, must be an object.
160
- * @returns {LifoList<T>} A LIFO list with methods to manipulate and query the list.
161
- */
162
75
  function createLifoList() {
163
76
  const list = createSet();
164
77
  const push = (item) => {
@@ -199,13 +112,6 @@ var HyperfrontendListUtils = (function (exports) {
199
112
  return freeze(result);
200
113
  }
201
114
 
202
- /**
203
- * Creates an array of numbers within a specified range (inclusive).
204
- *
205
- * @param start - The starting number of the range
206
- * @param end - The ending number of the range (inclusive)
207
- * @returns An array containing all numbers from start to end
208
- */
209
115
  function createRange(start, end) {
210
116
  const range = [];
211
117
  for (let i = start; i <= end; i += 1) {
@@ -214,32 +120,16 @@ var HyperfrontendListUtils = (function (exports) {
214
120
  return range;
215
121
  }
216
122
 
217
- /**
218
- * Creates a value picker that cycles through a list of string values.
219
- *
220
- * @param values - The array of string values to cycle through
221
- * @returns A ValuePicker instance with current and next methods
222
- */
223
123
  function createValuePicker(values) {
224
124
  if (!values || !values.length) {
225
125
  throw createError('Expected values not to be an empty list.');
226
126
  }
227
127
  let index = -1;
228
- /**
229
- * Returns the current value without advancing the picker.
230
- *
231
- * @returns The current value in the list
232
- */
233
128
  function current() {
234
129
  if (index < 0)
235
130
  index = 0;
236
131
  return values[index];
237
132
  }
238
- /**
239
- * Advances to and returns the next value, cycling back to the start when reaching the end.
240
- *
241
- * @returns The next value in the list
242
- */
243
133
  function next() {
244
134
  if (index < 0)
245
135
  return current();
@@ -252,28 +142,15 @@ var HyperfrontendListUtils = (function (exports) {
252
142
  };
253
143
  }
254
144
 
255
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
256
145
  const getLastKeyInMap = (map) => {
257
146
  const items = [...map.keys()];
258
147
  return items[items.length - 1];
259
148
  };
260
149
 
261
- /**
262
- * Filters out empty, null, undefined, and whitespace-only strings from an array.
263
- *
264
- * @param values - The array of strings to filter
265
- * @returns A new array containing only non-empty strings with content
266
- */
267
150
  function nonEmptyStrings(values) {
268
151
  return values.filter((value) => ![undefined, null, ''].includes(value) && value.trim() !== '');
269
152
  }
270
153
 
271
- /**
272
- * Removes duplicate strings from an array, preserving insertion order.
273
- *
274
- * @param values - The array of strings to deduplicate
275
- * @returns A new array containing only unique strings
276
- */
277
154
  function uniqueStrings(values) {
278
155
  return from(createSet(values));
279
156
  }
@@ -289,4 +166,3 @@ var HyperfrontendListUtils = (function (exports) {
289
166
  return exports;
290
167
 
291
168
  })({});
292
- //# sourceMappingURL=index.iife.js.map
@@ -1,2 +1 @@
1
- var HyperfrontendListUtils=function(e){"use strict";const t=globalThis.Object.freeze,r=[],n=globalThis.Array,o=n.isArray,i=n.from,l=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(o(e))return"array";for(const t of r)if(e instanceof t)return t.name}return t},s=globalThis.Error,a=globalThis.Reflect,u=(e,t)=>a.construct(s,[e,t]),c=globalThis.Set,f=globalThis.Reflect,h=e=>f.construct(c,e?[e]:[]);return e.createFifoList=function(){const e=h();return t({push:t=>{if("object"!==l(t))throw u("A fifo list only non-primitive values");if(e.has(t))throw u("Cannot a item that already exists");e.add(t)},pull:()=>{const t=e.values().next().value;return e.delete(t),t},map:t=>i(e.values()).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>e.clear()})},e.createLifoList=function(){const e=h();return t({push:t=>{if("object"!==l(t))throw u("A lifo list only supports non-primitive values");e.add(t)},pull:()=>{const t=i(e).pop();return t&&e.delete(t),t},map:t=>i(e).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>{e.clear()}})},e.createRange=function(e,t){const r=[];for(let n=e;n<=t;n+=1)r.push(n);return r},e.createValuePicker=function(e){if(!e||!e.length)throw u("Expected values not to be an empty list.");let t=-1;function r(){return t<0&&(t=0),e[t]}return{current:r,next:function(){return t<0?r():(t=++t<e.length?t:0,e[t])}}},e.getLastKeyInMap=e=>{const t=[...e.keys()];return t[t.length-1]},e.nonEmptyStrings=function(e){return e.filter(e=>![void 0,null,""].includes(e)&&""!==e.trim())},e.uniqueStrings=function(e){return i(h(e))},e}({});
2
- //# sourceMappingURL=index.iife.min.js.map
1
+ var HyperfrontendListUtils=function(e){"use strict";const t=globalThis.Array,r=t.isArray,n=t.from,o=globalThis.Error,i=globalThis.Reflect,s=(e,t)=>i.construct(o,[e,t]),l=globalThis.Object.freeze,a=[],u=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(r(e))return"array";for(const t of a)if(e instanceof t)return t.name}return t},c=globalThis.Set,f=globalThis.Reflect,h=e=>f.construct(c,e?[e]:[]);return e.createFifoList=function(){const e=h();return l({push:t=>{if("object"!==u(t))throw s("A fifo list only supports non-primitive values");if(e.has(t))throw s("Cannot push an item that already exists in the list");e.add(t)},pull:()=>{const t=e.values().next().value;return e.delete(t),t},map:t=>n(e.values()).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>e.clear()})},e.createLifoList=function(){const e=h();return l({push:t=>{if("object"!==u(t))throw s("A lifo list only supports non-primitive values");e.add(t)},pull:()=>{const t=n(e).pop();return t&&e.delete(t),t},map:t=>n(e).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>{e.clear()}})},e.createRange=function(e,t){const r=[];for(let n=e;n<=t;n+=1)r.push(n);return r},e.createValuePicker=function(e){if(!e||!e.length)throw s("Expected values not to be an empty list.");let t=-1;function r(){return t<0&&(t=0),e[t]}return{current:r,next:function(){return t<0?r():(t=++t<e.length?t:0,e[t])}}},e.getLastKeyInMap=e=>{const t=[...e.keys()];return t[t.length-1]},e.nonEmptyStrings=function(e){return e.filter(e=>![void 0,null,""].includes(e)&&""!==e.trim())},e.uniqueStrings=function(e){return n(h(e))},e}({});
@@ -4,51 +4,19 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.HyperfrontendListUtils = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- /**
8
- * Safe copies of Object built-in methods.
9
- *
10
- * These references are captured at module initialization time to protect against
11
- * prototype pollution attacks. Import only what you need for tree-shaking.
12
- *
13
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/object
14
- */
15
- // Capture references at module initialization time
7
+ const _Array = globalThis.Array;
8
+ const isArray = _Array.isArray;
9
+ const from = _Array.from;
10
+
11
+ const _Error = globalThis.Error;
12
+ const _Reflect$1 = globalThis.Reflect;
13
+ const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
14
+
16
15
  const _Object = globalThis.Object;
17
- /**
18
- * (Safe copy) Prevents modification of existing property attributes and values,
19
- * and prevents the addition of new properties.
20
- */
21
16
  const freeze = _Object.freeze;
22
17
 
23
18
  const registeredClasses = [];
24
19
 
25
- /**
26
- * Safe copies of Array built-in static methods.
27
- *
28
- * These references are captured at module initialization time to protect against
29
- * prototype pollution attacks. Import only what you need for tree-shaking.
30
- *
31
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/array
32
- */
33
- // Capture references at module initialization time
34
- const _Array = globalThis.Array;
35
- /**
36
- * (Safe copy) Determines whether the passed value is an Array.
37
- */
38
- const isArray = _Array.isArray;
39
- /**
40
- * (Safe copy) Creates an array from an array-like or iterable object.
41
- */
42
- const from = _Array.from;
43
-
44
- /**
45
- * Returns the data type of the target.
46
- * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
47
- * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
48
- *
49
- * @param target - The target to get the data type of.
50
- * @returns The data type of the target.
51
- */
52
20
  const getType = (target) => {
53
21
  if (target === null)
54
22
  return 'null';
@@ -64,67 +32,18 @@
64
32
  return nativeDataType;
65
33
  };
66
34
 
67
- /**
68
- * Safe copies of Error built-ins via factory functions.
69
- *
70
- * Since constructors cannot be safely captured via Object.assign, this module
71
- * provides factory functions that use Reflect.construct internally.
72
- *
73
- * These references are captured at module initialization time to protect against
74
- * prototype pollution attacks. Import only what you need for tree-shaking.
75
- *
76
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/error
77
- */
78
- // Capture references at module initialization time
79
- const _Error = globalThis.Error;
80
- const _Reflect$1 = globalThis.Reflect;
81
- /**
82
- * (Safe copy) Creates a new Error using the captured Error constructor.
83
- * Use this instead of `new Error()`.
84
- *
85
- * @param message - Optional error message.
86
- * @param options - Optional error options.
87
- * @returns A new Error instance.
88
- */
89
- const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
90
-
91
- /**
92
- * Safe copies of Set built-in via factory function.
93
- *
94
- * Since constructors cannot be safely captured via Object.assign, this module
95
- * provides a factory function that uses Reflect.construct internally.
96
- *
97
- * These references are captured at module initialization time to protect against
98
- * prototype pollution attacks. Import only what you need for tree-shaking.
99
- *
100
- * @module @hyperfrontend/immutable-api-utils/built-in-copy/set
101
- */
102
- // Capture references at module initialization time
103
35
  const _Set = globalThis.Set;
104
36
  const _Reflect = globalThis.Reflect;
105
- /**
106
- * (Safe copy) Creates a new Set using the captured Set constructor.
107
- * Use this instead of `new Set()`.
108
- *
109
- * @param iterable - Optional iterable of values.
110
- * @returns A new Set instance.
111
- */
112
37
  const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []);
113
38
 
114
- /**
115
- * Creates a FIFO (First-In-First-Out) list.
116
- *
117
- * @template T The type of elements in the list, must be an object.
118
- * @returns {FifoList<T>} A FIFO list with methods to manipulate and query the list.
119
- */
120
39
  function createFifoList() {
121
40
  const list = createSet();
122
41
  const push = (item) => {
123
42
  if (getType(item) !== 'object') {
124
- throw createError('A fifo list only non-primitive values');
43
+ throw createError('A fifo list only supports non-primitive values');
125
44
  }
126
45
  if (list.has(item)) {
127
- throw createError('Cannot a item that already exists');
46
+ throw createError('Cannot push an item that already exists in the list');
128
47
  }
129
48
  list.add(item);
130
49
  };
@@ -156,12 +75,6 @@
156
75
  return freeze(result);
157
76
  }
158
77
 
159
- /**
160
- * Creates a LIFO (Last-In-First-Out) list.
161
- *
162
- * @template T The type of elements in the list, must be an object.
163
- * @returns {LifoList<T>} A LIFO list with methods to manipulate and query the list.
164
- */
165
78
  function createLifoList() {
166
79
  const list = createSet();
167
80
  const push = (item) => {
@@ -202,13 +115,6 @@
202
115
  return freeze(result);
203
116
  }
204
117
 
205
- /**
206
- * Creates an array of numbers within a specified range (inclusive).
207
- *
208
- * @param start - The starting number of the range
209
- * @param end - The ending number of the range (inclusive)
210
- * @returns An array containing all numbers from start to end
211
- */
212
118
  function createRange(start, end) {
213
119
  const range = [];
214
120
  for (let i = start; i <= end; i += 1) {
@@ -217,32 +123,16 @@
217
123
  return range;
218
124
  }
219
125
 
220
- /**
221
- * Creates a value picker that cycles through a list of string values.
222
- *
223
- * @param values - The array of string values to cycle through
224
- * @returns A ValuePicker instance with current and next methods
225
- */
226
126
  function createValuePicker(values) {
227
127
  if (!values || !values.length) {
228
128
  throw createError('Expected values not to be an empty list.');
229
129
  }
230
130
  let index = -1;
231
- /**
232
- * Returns the current value without advancing the picker.
233
- *
234
- * @returns The current value in the list
235
- */
236
131
  function current() {
237
132
  if (index < 0)
238
133
  index = 0;
239
134
  return values[index];
240
135
  }
241
- /**
242
- * Advances to and returns the next value, cycling back to the start when reaching the end.
243
- *
244
- * @returns The next value in the list
245
- */
246
136
  function next() {
247
137
  if (index < 0)
248
138
  return current();
@@ -255,28 +145,15 @@
255
145
  };
256
146
  }
257
147
 
258
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
259
148
  const getLastKeyInMap = (map) => {
260
149
  const items = [...map.keys()];
261
150
  return items[items.length - 1];
262
151
  };
263
152
 
264
- /**
265
- * Filters out empty, null, undefined, and whitespace-only strings from an array.
266
- *
267
- * @param values - The array of strings to filter
268
- * @returns A new array containing only non-empty strings with content
269
- */
270
153
  function nonEmptyStrings(values) {
271
154
  return values.filter((value) => ![undefined, null, ''].includes(value) && value.trim() !== '');
272
155
  }
273
156
 
274
- /**
275
- * Removes duplicate strings from an array, preserving insertion order.
276
- *
277
- * @param values - The array of strings to deduplicate
278
- * @returns A new array containing only unique strings
279
- */
280
157
  function uniqueStrings(values) {
281
158
  return from(createSet(values));
282
159
  }
@@ -290,4 +167,3 @@
290
167
  exports.uniqueStrings = uniqueStrings;
291
168
 
292
169
  }));
293
- //# sourceMappingURL=index.umd.js.map
@@ -1,2 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendListUtils={})}(this,function(e){"use strict";const t=globalThis.Object.freeze,n=[],r=globalThis.Array,o=r.isArray,i=r.from,s=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(o(e))return"array";for(const t of n)if(e instanceof t)return t.name}return t},l=globalThis.Error,a=globalThis.Reflect,u=(e,t)=>a.construct(l,[e,t]),c=globalThis.Set,f=globalThis.Reflect,h=e=>f.construct(c,e?[e]:[]);e.createFifoList=function(){const e=h();return t({push:t=>{if("object"!==s(t))throw u("A fifo list only non-primitive values");if(e.has(t))throw u("Cannot a item that already exists");e.add(t)},pull:()=>{const t=e.values().next().value;return e.delete(t),t},map:t=>i(e.values()).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>e.clear()})},e.createLifoList=function(){const e=h();return t({push:t=>{if("object"!==s(t))throw u("A lifo list only supports non-primitive values");e.add(t)},pull:()=>{const t=i(e).pop();return t&&e.delete(t),t},map:t=>i(e).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>{e.clear()}})},e.createRange=function(e,t){const n=[];for(let r=e;r<=t;r+=1)n.push(r);return n},e.createValuePicker=function(e){if(!e||!e.length)throw u("Expected values not to be an empty list.");let t=-1;function n(){return t<0&&(t=0),e[t]}return{current:n,next:function(){return t<0?n():(t=++t<e.length?t:0,e[t])}}},e.getLastKeyInMap=e=>{const t=[...e.keys()];return t[t.length-1]},e.nonEmptyStrings=function(e){return e.filter(e=>![void 0,null,""].includes(e)&&""!==e.trim())},e.uniqueStrings=function(e){return i(h(e))}});
2
- //# sourceMappingURL=index.umd.min.js.map
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendListUtils={})}(this,function(e){"use strict";const t=globalThis.Array,n=t.isArray,r=t.from,o=globalThis.Error,i=globalThis.Reflect,s=(e,t)=>i.construct(o,[e,t]),l=globalThis.Object.freeze,a=[],u=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(n(e))return"array";for(const t of a)if(e instanceof t)return t.name}return t},c=globalThis.Set,f=globalThis.Reflect,h=e=>f.construct(c,e?[e]:[]);e.createFifoList=function(){const e=h();return l({push:t=>{if("object"!==u(t))throw s("A fifo list only supports non-primitive values");if(e.has(t))throw s("Cannot push an item that already exists in the list");e.add(t)},pull:()=>{const t=e.values().next().value;return e.delete(t),t},map:t=>r(e.values()).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>e.clear()})},e.createLifoList=function(){const e=h();return l({push:t=>{if("object"!==u(t))throw s("A lifo list only supports non-primitive values");e.add(t)},pull:()=>{const t=r(e).pop();return t&&e.delete(t),t},map:t=>r(e).map(t),forEach:t=>{e.forEach(t)},remove:t=>e.delete(t),has:t=>e.has(t),size:()=>e.size,clear:()=>{e.clear()}})},e.createRange=function(e,t){const n=[];for(let r=e;r<=t;r+=1)n.push(r);return n},e.createValuePicker=function(e){if(!e||!e.length)throw s("Expected values not to be an empty list.");let t=-1;function n(){return t<0&&(t=0),e[t]}return{current:n,next:function(){return t<0?n():(t=++t<e.length?t:0,e[t])}}},e.getLastKeyInMap=e=>{const t=[...e.keys()];return t[t.length-1]},e.nonEmptyStrings=function(e){return e.filter(e=>![void 0,null,""].includes(e)&&""!==e.trim())},e.uniqueStrings=function(e){return r(h(e))}});