@hyperfrontend/immutable-api-utils 0.0.2 → 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.
- package/CHANGELOG.md +16 -0
- package/README.md +65 -4
- package/built-in-copy/array/index.cjs.js +40 -0
- package/built-in-copy/array/index.cjs.js.map +1 -0
- package/built-in-copy/array/index.d.ts +40 -0
- package/built-in-copy/array/index.d.ts.map +1 -0
- package/built-in-copy/array/index.esm.js +35 -0
- package/built-in-copy/array/index.esm.js.map +1 -0
- package/built-in-copy/console/index.cjs.js +130 -0
- package/built-in-copy/console/index.cjs.js.map +1 -0
- package/built-in-copy/console/index.d.ts +105 -0
- package/built-in-copy/console/index.d.ts.map +1 -0
- package/built-in-copy/console/index.esm.js +110 -0
- package/built-in-copy/console/index.esm.js.map +1 -0
- package/built-in-copy/date/index.cjs.js +49 -0
- package/built-in-copy/date/index.cjs.js.map +1 -0
- package/built-in-copy/date/index.d.ts +49 -0
- package/built-in-copy/date/index.d.ts.map +1 -0
- package/built-in-copy/date/index.esm.js +43 -0
- package/built-in-copy/date/index.esm.js.map +1 -0
- package/built-in-copy/encoding/index.cjs.js +67 -0
- package/built-in-copy/encoding/index.cjs.js.map +1 -0
- package/built-in-copy/encoding/index.d.ts +52 -0
- package/built-in-copy/encoding/index.d.ts.map +1 -0
- package/built-in-copy/encoding/index.esm.js +61 -0
- package/built-in-copy/encoding/index.esm.js.map +1 -0
- package/built-in-copy/error/index.cjs.js +122 -0
- package/built-in-copy/error/index.cjs.js.map +1 -0
- package/built-in-copy/error/index.d.ts +99 -0
- package/built-in-copy/error/index.d.ts.map +1 -0
- package/built-in-copy/error/index.esm.js +112 -0
- package/built-in-copy/error/index.esm.js.map +1 -0
- package/built-in-copy/function/index.cjs.js +61 -0
- package/built-in-copy/function/index.cjs.js.map +1 -0
- package/built-in-copy/function/index.d.ts +47 -0
- package/built-in-copy/function/index.d.ts.map +1 -0
- package/built-in-copy/function/index.esm.js +54 -0
- package/built-in-copy/function/index.esm.js.map +1 -0
- package/built-in-copy/json/index.cjs.js +34 -0
- package/built-in-copy/json/index.cjs.js.map +1 -0
- package/built-in-copy/json/index.d.ts +31 -0
- package/built-in-copy/json/index.d.ts.map +1 -0
- package/built-in-copy/json/index.esm.js +30 -0
- package/built-in-copy/json/index.esm.js.map +1 -0
- package/built-in-copy/map/index.cjs.js +44 -0
- package/built-in-copy/map/index.cjs.js.map +1 -0
- package/built-in-copy/map/index.d.ts +33 -0
- package/built-in-copy/map/index.d.ts.map +1 -0
- package/built-in-copy/map/index.esm.js +40 -0
- package/built-in-copy/map/index.esm.js.map +1 -0
- package/built-in-copy/math/index.cjs.js +317 -0
- package/built-in-copy/math/index.cjs.js.map +1 -0
- package/built-in-copy/math/index.d.ts +232 -0
- package/built-in-copy/math/index.d.ts.map +1 -0
- package/built-in-copy/math/index.esm.js +272 -0
- package/built-in-copy/math/index.esm.js.map +1 -0
- package/built-in-copy/messaging/index.cjs.js +123 -0
- package/built-in-copy/messaging/index.cjs.js.map +1 -0
- package/built-in-copy/messaging/index.d.ts +95 -0
- package/built-in-copy/messaging/index.d.ts.map +1 -0
- package/built-in-copy/messaging/index.esm.js +114 -0
- package/built-in-copy/messaging/index.esm.js.map +1 -0
- package/built-in-copy/number/index.cjs.js +141 -0
- package/built-in-copy/number/index.cjs.js.map +1 -0
- package/built-in-copy/number/index.d.ts +95 -0
- package/built-in-copy/number/index.d.ts.map +1 -0
- package/built-in-copy/number/index.esm.js +123 -0
- package/built-in-copy/number/index.esm.js.map +1 -0
- package/built-in-copy/object/index.cjs.js +174 -0
- package/built-in-copy/object/index.cjs.js.map +1 -0
- package/built-in-copy/object/index.d.ts +209 -0
- package/built-in-copy/object/index.d.ts.map +1 -0
- package/built-in-copy/object/index.esm.js +149 -0
- package/built-in-copy/object/index.esm.js.map +1 -0
- package/built-in-copy/promise/index.cjs.js +80 -0
- package/built-in-copy/promise/index.cjs.js.map +1 -0
- package/built-in-copy/promise/index.d.ts +63 -0
- package/built-in-copy/promise/index.d.ts.map +1 -0
- package/built-in-copy/promise/index.esm.js +70 -0
- package/built-in-copy/promise/index.esm.js.map +1 -0
- package/built-in-copy/reflect/index.cjs.js +101 -0
- package/built-in-copy/reflect/index.cjs.js.map +1 -0
- package/built-in-copy/reflect/index.d.ts +81 -0
- package/built-in-copy/reflect/index.d.ts.map +1 -0
- package/built-in-copy/reflect/index.esm.js +86 -0
- package/built-in-copy/reflect/index.esm.js.map +1 -0
- package/built-in-copy/regexp/index.cjs.js +37 -0
- package/built-in-copy/regexp/index.cjs.js.map +1 -0
- package/built-in-copy/regexp/index.d.ts +28 -0
- package/built-in-copy/regexp/index.d.ts.map +1 -0
- package/built-in-copy/regexp/index.esm.js +34 -0
- package/built-in-copy/regexp/index.esm.js.map +1 -0
- package/built-in-copy/set/index.cjs.js +36 -0
- package/built-in-copy/set/index.cjs.js.map +1 -0
- package/built-in-copy/set/index.d.ts +27 -0
- package/built-in-copy/set/index.d.ts.map +1 -0
- package/built-in-copy/set/index.esm.js +33 -0
- package/built-in-copy/set/index.esm.js.map +1 -0
- package/built-in-copy/string/index.cjs.js +46 -0
- package/built-in-copy/string/index.cjs.js.map +1 -0
- package/built-in-copy/string/index.d.ts +34 -0
- package/built-in-copy/string/index.d.ts.map +1 -0
- package/built-in-copy/string/index.esm.js +41 -0
- package/built-in-copy/string/index.esm.js.map +1 -0
- package/built-in-copy/symbol/index.cjs.js +123 -0
- package/built-in-copy/symbol/index.cjs.js.map +1 -0
- package/built-in-copy/symbol/index.d.ts +99 -0
- package/built-in-copy/symbol/index.d.ts.map +1 -0
- package/built-in-copy/symbol/index.esm.js +105 -0
- package/built-in-copy/symbol/index.esm.js.map +1 -0
- package/built-in-copy/timers/index.cjs.js +105 -0
- package/built-in-copy/timers/index.cjs.js.map +1 -0
- package/built-in-copy/timers/index.d.ts +73 -0
- package/built-in-copy/timers/index.d.ts.map +1 -0
- package/built-in-copy/timers/index.esm.js +96 -0
- package/built-in-copy/timers/index.esm.js.map +1 -0
- package/built-in-copy/typed-arrays/index.cjs.js +360 -0
- package/built-in-copy/typed-arrays/index.cjs.js.map +1 -0
- package/built-in-copy/typed-arrays/index.d.ts +321 -0
- package/built-in-copy/typed-arrays/index.d.ts.map +1 -0
- package/built-in-copy/typed-arrays/index.esm.js +321 -0
- package/built-in-copy/typed-arrays/index.esm.js.map +1 -0
- package/built-in-copy/url/index.cjs.js +103 -0
- package/built-in-copy/url/index.cjs.js.map +1 -0
- package/built-in-copy/url/index.d.ts +71 -0
- package/built-in-copy/url/index.d.ts.map +1 -0
- package/built-in-copy/url/index.esm.js +95 -0
- package/built-in-copy/url/index.esm.js.map +1 -0
- package/built-in-copy/weak-map/index.cjs.js +36 -0
- package/built-in-copy/weak-map/index.cjs.js.map +1 -0
- package/built-in-copy/weak-map/index.d.ts +27 -0
- package/built-in-copy/weak-map/index.d.ts.map +1 -0
- package/built-in-copy/weak-map/index.esm.js +33 -0
- package/built-in-copy/weak-map/index.esm.js.map +1 -0
- package/built-in-copy/weak-set/index.cjs.js +36 -0
- package/built-in-copy/weak-set/index.cjs.js.map +1 -0
- package/built-in-copy/weak-set/index.d.ts +27 -0
- package/built-in-copy/weak-set/index.d.ts.map +1 -0
- package/built-in-copy/weak-set/index.esm.js +33 -0
- package/built-in-copy/weak-set/index.esm.js.map +1 -0
- package/built-in-copy/websocket/index.cjs.js +50 -0
- package/built-in-copy/websocket/index.cjs.js.map +1 -0
- package/built-in-copy/websocket/index.d.ts +37 -0
- package/built-in-copy/websocket/index.d.ts.map +1 -0
- package/built-in-copy/websocket/index.esm.js +43 -0
- package/built-in-copy/websocket/index.esm.js.map +1 -0
- package/bundle/index.iife.js +1167 -5
- package/bundle/index.iife.js.map +1 -1
- package/bundle/index.iife.min.js +1 -1
- package/bundle/index.iife.min.js.map +1 -1
- package/bundle/index.umd.js +1167 -5
- package/bundle/index.umd.js.map +1 -1
- package/bundle/index.umd.min.js +1 -1
- package/bundle/index.umd.min.js.map +1 -1
- package/index.cjs.js +1167 -5
- package/index.cjs.js.map +1 -1
- package/index.d.ts +32 -3
- package/index.d.ts.map +1 -1
- package/index.esm.js +1151 -6
- package/index.esm.js.map +1 -1
- package/lib/locked-prop-descriptors.d.ts.map +1 -0
- package/lib/locked-props.d.ts.map +1 -0
- package/{locked.d.ts → lib/locked.d.ts} +12 -1
- package/lib/locked.d.ts.map +1 -0
- package/locked/index.cjs.js +107 -0
- package/locked/index.cjs.js.map +1 -0
- package/locked/index.d.ts +2 -0
- package/locked/index.d.ts.map +1 -0
- package/locked/index.esm.js +105 -0
- package/locked/index.esm.js.map +1 -0
- package/locked-prop-descriptors/index.cjs.js +11 -0
- package/locked-prop-descriptors/index.cjs.js.map +1 -0
- package/locked-prop-descriptors/index.d.ts +2 -0
- package/locked-prop-descriptors/index.d.ts.map +1 -0
- package/locked-prop-descriptors/index.esm.js +9 -0
- package/locked-prop-descriptors/index.esm.js.map +1 -0
- package/locked-props/index.cjs.js +32 -0
- package/locked-props/index.cjs.js.map +1 -0
- package/locked-props/index.d.ts +2 -0
- package/locked-props/index.d.ts.map +1 -0
- package/locked-props/index.esm.js +30 -0
- package/locked-props/index.esm.js.map +1 -0
- package/package.json +149 -14
- package/locked-prop-descriptors.d.ts.map +0 -1
- package/locked-props.d.ts.map +0 -1
- package/locked.d.ts.map +0 -1
- /package/{locked-prop-descriptors.d.ts → lib/locked-prop-descriptors.d.ts} +0 -0
- /package/{locked-props.d.ts → lib/locked-props.d.ts} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Error built-ins via factory functions.
|
|
3
|
+
*
|
|
4
|
+
* Since constructors cannot be safely captured via Object.assign, this module
|
|
5
|
+
* provides factory functions that use Reflect.construct internally.
|
|
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/error
|
|
11
|
+
*/
|
|
12
|
+
// Capture references at module initialization time
|
|
13
|
+
const _Error = globalThis.Error;
|
|
14
|
+
const _TypeError = globalThis.TypeError;
|
|
15
|
+
const _RangeError = globalThis.RangeError;
|
|
16
|
+
const _ReferenceError = globalThis.ReferenceError;
|
|
17
|
+
const _SyntaxError = globalThis.SyntaxError;
|
|
18
|
+
const _URIError = globalThis.URIError;
|
|
19
|
+
const _EvalError = globalThis.EvalError;
|
|
20
|
+
const _AggregateError = globalThis.AggregateError;
|
|
21
|
+
const _Reflect = globalThis.Reflect;
|
|
22
|
+
const _freeze = globalThis.Object.freeze;
|
|
23
|
+
/**
|
|
24
|
+
* (Safe copy) Creates a new Error using the captured Error constructor.
|
|
25
|
+
* Use this instead of `new Error()`.
|
|
26
|
+
*
|
|
27
|
+
* @param message - Optional error message.
|
|
28
|
+
* @param options - Optional error options.
|
|
29
|
+
* @returns A new Error instance.
|
|
30
|
+
*/
|
|
31
|
+
const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
|
|
32
|
+
/**
|
|
33
|
+
* (Safe copy) Creates a new TypeError using the captured TypeError constructor.
|
|
34
|
+
* Use this instead of `new TypeError()`.
|
|
35
|
+
*
|
|
36
|
+
* @param message - Optional error message.
|
|
37
|
+
* @param options - Optional error options.
|
|
38
|
+
* @returns A new TypeError instance.
|
|
39
|
+
*/
|
|
40
|
+
const createTypeError = (message, options) => _Reflect.construct(_TypeError, [message, options]);
|
|
41
|
+
/**
|
|
42
|
+
* (Safe copy) Creates a new RangeError using the captured RangeError constructor.
|
|
43
|
+
* Use this instead of `new RangeError()`.
|
|
44
|
+
*
|
|
45
|
+
* @param message - Optional error message.
|
|
46
|
+
* @param options - Optional error options.
|
|
47
|
+
* @returns A new RangeError instance.
|
|
48
|
+
*/
|
|
49
|
+
const createRangeError = (message, options) => _Reflect.construct(_RangeError, [message, options]);
|
|
50
|
+
/**
|
|
51
|
+
* (Safe copy) Creates a new ReferenceError using the captured ReferenceError constructor.
|
|
52
|
+
* Use this instead of `new ReferenceError()`.
|
|
53
|
+
*
|
|
54
|
+
* @param message - Optional error message.
|
|
55
|
+
* @param options - Optional error options.
|
|
56
|
+
* @returns A new ReferenceError instance.
|
|
57
|
+
*/
|
|
58
|
+
const createReferenceError = (message, options) => _Reflect.construct(_ReferenceError, [message, options]);
|
|
59
|
+
/**
|
|
60
|
+
* (Safe copy) Creates a new SyntaxError using the captured SyntaxError constructor.
|
|
61
|
+
* Use this instead of `new SyntaxError()`.
|
|
62
|
+
*
|
|
63
|
+
* @param message - Optional error message.
|
|
64
|
+
* @param options - Optional error options.
|
|
65
|
+
* @returns A new SyntaxError instance.
|
|
66
|
+
*/
|
|
67
|
+
const createSyntaxError = (message, options) => _Reflect.construct(_SyntaxError, [message, options]);
|
|
68
|
+
/**
|
|
69
|
+
* (Safe copy) Creates a new URIError using the captured URIError constructor.
|
|
70
|
+
* Use this instead of `new URIError()`.
|
|
71
|
+
*
|
|
72
|
+
* @param message - Optional error message.
|
|
73
|
+
* @param options - Optional error options.
|
|
74
|
+
* @returns A new URIError instance.
|
|
75
|
+
*/
|
|
76
|
+
const createURIError = (message, options) => _Reflect.construct(_URIError, [message, options]);
|
|
77
|
+
/**
|
|
78
|
+
* (Safe copy) Creates a new EvalError using the captured EvalError constructor.
|
|
79
|
+
* Use this instead of `new EvalError()`.
|
|
80
|
+
*
|
|
81
|
+
* @param message - Optional error message.
|
|
82
|
+
* @param options - Optional error options.
|
|
83
|
+
* @returns A new EvalError instance.
|
|
84
|
+
*/
|
|
85
|
+
const createEvalError = (message, options) => _Reflect.construct(_EvalError, [message, options]);
|
|
86
|
+
/**
|
|
87
|
+
* (Safe copy) Creates a new AggregateError using the captured AggregateError constructor.
|
|
88
|
+
* Use this instead of `new AggregateError()`.
|
|
89
|
+
*
|
|
90
|
+
* @param errors - An iterable of errors to aggregate.
|
|
91
|
+
* @param message - Optional error message.
|
|
92
|
+
* @param options - Optional error options.
|
|
93
|
+
* @returns A new AggregateError instance.
|
|
94
|
+
*/
|
|
95
|
+
const createAggregateError = (errors, message, options) => _Reflect.construct(_AggregateError, [errors, message, options]);
|
|
96
|
+
/**
|
|
97
|
+
* (Safe copy) Namespace object containing Error factory functions.
|
|
98
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
99
|
+
*/
|
|
100
|
+
const Error = _freeze({
|
|
101
|
+
create: createError,
|
|
102
|
+
TypeError: createTypeError,
|
|
103
|
+
RangeError: createRangeError,
|
|
104
|
+
ReferenceError: createReferenceError,
|
|
105
|
+
SyntaxError: createSyntaxError,
|
|
106
|
+
URIError: createURIError,
|
|
107
|
+
EvalError: createEvalError,
|
|
108
|
+
AggregateError: createAggregateError,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export { Error, createAggregateError, createError, createEvalError, createRangeError, createReferenceError, createSyntaxError, createTypeError, createURIError };
|
|
112
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;AAUG;AAEH;AACA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;AAC/B,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS;AACvC,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU;AACzC,MAAM,eAAe,GAAG,UAAU,CAAC,cAAc;AACjD,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW;AAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AACrC,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS;AACvC,MAAM,eAAe,GAAG,UAAU,CAAC,cAAc;AACjD,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;;;;;;AAOG;MACU,WAAW,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAAmB,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAEpI;;;;;;;AAOG;MACU,eAAe,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAE9D;;;;;;;AAOG;MACU,gBAAgB,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAEhE;;;;;;;AAOG;MACU,oBAAoB,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAExE;;;;;;;AAOG;MACU,iBAAiB,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAElE;;;;;;;AAOG;MACU,cAAc,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAE5D;;;;;;;AAOG;MACU,eAAe,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAC3D,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAE9D;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,MAAyB,EAAE,OAAgB,EAAE,OAAsB,KACtF,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;AAEhF;;;AAGG;AACI,MAAM,KAAK,GAAG,OAAO,CAAQ;AAClC,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,SAAS,EAAE,eAAe;AAC1B,IAAA,UAAU,EAAE,gBAAgB;AAC5B,IAAA,cAAc,EAAE,oBAAoB;AACpC,IAAA,WAAW,EAAE,iBAAiB;AAC9B,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,SAAS,EAAE,eAAe;AAC1B,IAAA,cAAc,EAAE,oBAAoB;AACrC,CAAA;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safe copies of Function built-in and utilities.
|
|
5
|
+
*
|
|
6
|
+
* These references are captured at module initialization time to protect against
|
|
7
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
8
|
+
*
|
|
9
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/function
|
|
10
|
+
*/
|
|
11
|
+
// Capture references at module initialization time
|
|
12
|
+
const _Function = globalThis.Function;
|
|
13
|
+
const _FunctionPrototype = _Function.prototype;
|
|
14
|
+
const _Reflect = globalThis.Reflect;
|
|
15
|
+
const _freeze = globalThis.Object.freeze;
|
|
16
|
+
/**
|
|
17
|
+
* (Safe copy) Creates a new Function using the captured Function constructor.
|
|
18
|
+
* Use this instead of `new Function()`.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: Dynamic code generation via Function constructor should be avoided when possible
|
|
21
|
+
* due to security risks similar to eval().
|
|
22
|
+
*
|
|
23
|
+
* @param args - Function body and parameter strings.
|
|
24
|
+
* @returns A new Function.
|
|
25
|
+
*/
|
|
26
|
+
const createFunction = (...args) => _Reflect.construct(_Function, args);
|
|
27
|
+
/**
|
|
28
|
+
* (Safe copy) Reference to the captured Function.prototype.
|
|
29
|
+
*/
|
|
30
|
+
const functionPrototype = _FunctionPrototype;
|
|
31
|
+
/**
|
|
32
|
+
* (Safe copy) Reference to the captured Function.prototype.call.
|
|
33
|
+
*/
|
|
34
|
+
const functionCall = _FunctionPrototype.call;
|
|
35
|
+
/**
|
|
36
|
+
* (Safe copy) Reference to the captured Function.prototype.apply.
|
|
37
|
+
*/
|
|
38
|
+
const functionApply = _FunctionPrototype.apply;
|
|
39
|
+
/**
|
|
40
|
+
* (Safe copy) Reference to the captured Function.prototype.bind.
|
|
41
|
+
*/
|
|
42
|
+
const functionBind = _FunctionPrototype.bind;
|
|
43
|
+
/**
|
|
44
|
+
* (Safe copy) Namespace object containing Function utilities.
|
|
45
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
46
|
+
*/
|
|
47
|
+
const Function = _freeze({
|
|
48
|
+
create: createFunction,
|
|
49
|
+
prototype: functionPrototype,
|
|
50
|
+
call: functionCall,
|
|
51
|
+
apply: functionApply,
|
|
52
|
+
bind: functionBind,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
exports.Function = Function;
|
|
56
|
+
exports.createFunction = createFunction;
|
|
57
|
+
exports.functionApply = functionApply;
|
|
58
|
+
exports.functionBind = functionBind;
|
|
59
|
+
exports.functionCall = functionCall;
|
|
60
|
+
exports.functionPrototype = functionPrototype;
|
|
61
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/function/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS;AAC9C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;;;;;;;;AASG;AACI,MAAM,cAAc,GAAG,CAAC,GAAG,IAAc,KACb,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI;AAErE;;AAEG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;AAEG;AACI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;AAEG;AACI,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEhD;;AAEG;AACI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;;AAGG;AACI,MAAM,QAAQ,GAAG,OAAO,CAAQ;AACrC,IAAA,MAAM,EAAE,cAAc;AACtB,IAAA,SAAS,EAAE,iBAAiB;AAC5B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,IAAI,EAAE,YAAY;AACnB,CAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Function built-in and utilities.
|
|
3
|
+
*
|
|
4
|
+
* These references are captured at module initialization time to protect against
|
|
5
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
6
|
+
*
|
|
7
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/function
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* (Safe copy) Creates a new Function using the captured Function constructor.
|
|
11
|
+
* Use this instead of `new Function()`.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: Dynamic code generation via Function constructor should be avoided when possible
|
|
14
|
+
* due to security risks similar to eval().
|
|
15
|
+
*
|
|
16
|
+
* @param args - Function body and parameter strings.
|
|
17
|
+
* @returns A new Function.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createFunction: (...args: string[]) => ((...args: unknown[]) => unknown);
|
|
20
|
+
/**
|
|
21
|
+
* (Safe copy) Reference to the captured Function.prototype.
|
|
22
|
+
*/
|
|
23
|
+
export declare const functionPrototype: Function;
|
|
24
|
+
/**
|
|
25
|
+
* (Safe copy) Reference to the captured Function.prototype.call.
|
|
26
|
+
*/
|
|
27
|
+
export declare const functionCall: (this: Function, thisArg: any, ...argArray: any[]) => any;
|
|
28
|
+
/**
|
|
29
|
+
* (Safe copy) Reference to the captured Function.prototype.apply.
|
|
30
|
+
*/
|
|
31
|
+
export declare const functionApply: (this: Function, thisArg: any, argArray?: any) => any;
|
|
32
|
+
/**
|
|
33
|
+
* (Safe copy) Reference to the captured Function.prototype.bind.
|
|
34
|
+
*/
|
|
35
|
+
export declare const functionBind: (this: Function, thisArg: any, ...argArray: any[]) => any;
|
|
36
|
+
/**
|
|
37
|
+
* (Safe copy) Namespace object containing Function utilities.
|
|
38
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
39
|
+
*/
|
|
40
|
+
export declare const Function: Readonly<{
|
|
41
|
+
readonly create: (...args: string[]) => ((...args: unknown[]) => unknown);
|
|
42
|
+
readonly prototype: Function;
|
|
43
|
+
readonly call: (this: Function, thisArg: any, ...argArray: any[]) => any;
|
|
44
|
+
readonly apply: (this: Function, thisArg: any, argArray?: any) => any;
|
|
45
|
+
readonly bind: (this: Function, thisArg: any, ...argArray: any[]) => any;
|
|
46
|
+
}>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/function/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,MAAM,EAAE,KAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CACb,CAAA;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAqB,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,YAAY,2DAA0B,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,aAAa,uDAA2B,CAAA;AAErD;;GAEG;AACH,eAAO,MAAM,YAAY,2DAA0B,CAAA;AAEnD;;;GAGG;AACH,eAAO,MAAM,QAAQ;+BA3BmB,MAAM,EAAE,KAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;;;;;EAiClF,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Function built-in and utilities.
|
|
3
|
+
*
|
|
4
|
+
* These references are captured at module initialization time to protect against
|
|
5
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
6
|
+
*
|
|
7
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/function
|
|
8
|
+
*/
|
|
9
|
+
// Capture references at module initialization time
|
|
10
|
+
const _Function = globalThis.Function;
|
|
11
|
+
const _FunctionPrototype = _Function.prototype;
|
|
12
|
+
const _Reflect = globalThis.Reflect;
|
|
13
|
+
const _freeze = globalThis.Object.freeze;
|
|
14
|
+
/**
|
|
15
|
+
* (Safe copy) Creates a new Function using the captured Function constructor.
|
|
16
|
+
* Use this instead of `new Function()`.
|
|
17
|
+
*
|
|
18
|
+
* NOTE: Dynamic code generation via Function constructor should be avoided when possible
|
|
19
|
+
* due to security risks similar to eval().
|
|
20
|
+
*
|
|
21
|
+
* @param args - Function body and parameter strings.
|
|
22
|
+
* @returns A new Function.
|
|
23
|
+
*/
|
|
24
|
+
const createFunction = (...args) => _Reflect.construct(_Function, args);
|
|
25
|
+
/**
|
|
26
|
+
* (Safe copy) Reference to the captured Function.prototype.
|
|
27
|
+
*/
|
|
28
|
+
const functionPrototype = _FunctionPrototype;
|
|
29
|
+
/**
|
|
30
|
+
* (Safe copy) Reference to the captured Function.prototype.call.
|
|
31
|
+
*/
|
|
32
|
+
const functionCall = _FunctionPrototype.call;
|
|
33
|
+
/**
|
|
34
|
+
* (Safe copy) Reference to the captured Function.prototype.apply.
|
|
35
|
+
*/
|
|
36
|
+
const functionApply = _FunctionPrototype.apply;
|
|
37
|
+
/**
|
|
38
|
+
* (Safe copy) Reference to the captured Function.prototype.bind.
|
|
39
|
+
*/
|
|
40
|
+
const functionBind = _FunctionPrototype.bind;
|
|
41
|
+
/**
|
|
42
|
+
* (Safe copy) Namespace object containing Function utilities.
|
|
43
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
44
|
+
*/
|
|
45
|
+
const Function = _freeze({
|
|
46
|
+
create: createFunction,
|
|
47
|
+
prototype: functionPrototype,
|
|
48
|
+
call: functionCall,
|
|
49
|
+
apply: functionApply,
|
|
50
|
+
bind: functionBind,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { Function, createFunction, functionApply, functionBind, functionCall, functionPrototype };
|
|
54
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/function/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ;AACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC,SAAS;AAC9C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;;;;;;;;AASG;AACI,MAAM,cAAc,GAAG,CAAC,GAAG,IAAc,KACb,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI;AAErE;;AAEG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;AAEG;AACI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;AAEG;AACI,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEhD;;AAEG;AACI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C;;;AAGG;AACI,MAAM,QAAQ,GAAG,OAAO,CAAQ;AACrC,IAAA,MAAM,EAAE,cAAc;AACtB,IAAA,SAAS,EAAE,iBAAiB;AAC5B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,IAAI,EAAE,YAAY;AACnB,CAAA;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safe copies of JSON built-in methods.
|
|
5
|
+
*
|
|
6
|
+
* These references are captured at module initialization time to protect against
|
|
7
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
8
|
+
*
|
|
9
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
10
|
+
*/
|
|
11
|
+
// Capture references at module initialization time
|
|
12
|
+
const _JSON = globalThis.JSON;
|
|
13
|
+
const _freeze = globalThis.Object.freeze;
|
|
14
|
+
/**
|
|
15
|
+
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
16
|
+
*/
|
|
17
|
+
const parse = _JSON.parse;
|
|
18
|
+
/**
|
|
19
|
+
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
20
|
+
*/
|
|
21
|
+
const stringify = _JSON.stringify;
|
|
22
|
+
/**
|
|
23
|
+
* (Safe copy) Namespace object containing all JSON methods.
|
|
24
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
25
|
+
*/
|
|
26
|
+
const JSON = _freeze({
|
|
27
|
+
parse,
|
|
28
|
+
stringify,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
exports.JSON = JSON;
|
|
32
|
+
exports.parse = parse;
|
|
33
|
+
exports.stringify = stringify;
|
|
34
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/json/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;AAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;AAEG;AACI,MAAM,KAAK,GAAG,KAAK,CAAC;AAE3B;;AAEG;AACI,MAAM,SAAS,GAAG,KAAK,CAAC;AAE/B;;;AAGG;AACI,MAAM,IAAI,GAAG,OAAO,CAAQ;IACjC,KAAK;IACL,SAAS;AACV,CAAA;;;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of JSON built-in methods.
|
|
3
|
+
*
|
|
4
|
+
* These references are captured at module initialization time to protect against
|
|
5
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
6
|
+
*
|
|
7
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
11
|
+
*/
|
|
12
|
+
export declare const parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
|
|
13
|
+
/**
|
|
14
|
+
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
15
|
+
*/
|
|
16
|
+
export declare const stringify: {
|
|
17
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
18
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* (Safe copy) Namespace object containing all JSON methods.
|
|
22
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
23
|
+
*/
|
|
24
|
+
export declare const JSON: Readonly<{
|
|
25
|
+
readonly parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
|
|
26
|
+
readonly stringify: {
|
|
27
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
28
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/json/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,eAAO,MAAM,KAAK,8EAAc,CAAA;AAEhC;;GAEG;AACH,eAAO,MAAM,SAAS;;;CAAkB,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,IAAI;;;;;;EAGf,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of JSON built-in methods.
|
|
3
|
+
*
|
|
4
|
+
* These references are captured at module initialization time to protect against
|
|
5
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
6
|
+
*
|
|
7
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
8
|
+
*/
|
|
9
|
+
// Capture references at module initialization time
|
|
10
|
+
const _JSON = globalThis.JSON;
|
|
11
|
+
const _freeze = globalThis.Object.freeze;
|
|
12
|
+
/**
|
|
13
|
+
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
14
|
+
*/
|
|
15
|
+
const parse = _JSON.parse;
|
|
16
|
+
/**
|
|
17
|
+
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
18
|
+
*/
|
|
19
|
+
const stringify = _JSON.stringify;
|
|
20
|
+
/**
|
|
21
|
+
* (Safe copy) Namespace object containing all JSON methods.
|
|
22
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
23
|
+
*/
|
|
24
|
+
const JSON = _freeze({
|
|
25
|
+
parse,
|
|
26
|
+
stringify,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { JSON, parse, stringify };
|
|
30
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/json/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;AAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;AAEG;AACI,MAAM,KAAK,GAAG,KAAK,CAAC;AAE3B;;AAEG;AACI,MAAM,SAAS,GAAG,KAAK,CAAC;AAE/B;;;AAGG;AACI,MAAM,IAAI,GAAG,OAAO,CAAQ;IACjC,KAAK;IACL,SAAS;AACV,CAAA;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safe copies of Map built-in via factory function.
|
|
5
|
+
*
|
|
6
|
+
* Since constructors cannot be safely captured via Object.assign, this module
|
|
7
|
+
* provides a factory function that uses Reflect.construct internally.
|
|
8
|
+
*
|
|
9
|
+
* These references are captured at module initialization time to protect against
|
|
10
|
+
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
11
|
+
*
|
|
12
|
+
* @module @hyperfrontend/immutable-api-utils/built-in-copy/map
|
|
13
|
+
*/
|
|
14
|
+
// Capture references at module initialization time
|
|
15
|
+
const _Map = globalThis.Map;
|
|
16
|
+
const _Reflect = globalThis.Reflect;
|
|
17
|
+
const _freeze = globalThis.Object.freeze;
|
|
18
|
+
/**
|
|
19
|
+
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
20
|
+
* Use this instead of `new Map()`.
|
|
21
|
+
*
|
|
22
|
+
* @param iterable - Optional iterable of key-value pairs.
|
|
23
|
+
* @returns A new Map instance.
|
|
24
|
+
*/
|
|
25
|
+
const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []);
|
|
26
|
+
/**
|
|
27
|
+
* (Safe copy) Groups elements by key using the captured Map.groupBy if available.
|
|
28
|
+
* Note: Available only in ES2024+ environments.
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
const mapGroupBy = _Map.groupBy;
|
|
32
|
+
/**
|
|
33
|
+
* (Safe copy) Namespace object containing Map factory.
|
|
34
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
35
|
+
*/
|
|
36
|
+
const Map = _freeze({
|
|
37
|
+
create: createMap,
|
|
38
|
+
groupBy: mapGroupBy,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.Map = Map;
|
|
42
|
+
exports.createMap = createMap;
|
|
43
|
+
exports.mapGroupBy = mapGroupBy;
|
|
44
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AAEH;AACA,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG;AAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;;;;;AAMG;AACI,MAAM,SAAS,GAAG,CAAO,QAA2C,KAC9D,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE;AAEhE;;;AAGG;AACH;AACO,MAAM,UAAU,GAAS,IAAK,CAAC;AAEtC;;;AAGG;AACI,MAAM,GAAG,GAAG,OAAO,CAAQ;AAChC,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,OAAO,EAAE,UAAU;AACpB,CAAA;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Map built-in via factory function.
|
|
3
|
+
*
|
|
4
|
+
* Since constructors cannot be safely captured via Object.assign, this module
|
|
5
|
+
* provides a factory function that uses Reflect.construct internally.
|
|
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/map
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
14
|
+
* Use this instead of `new Map()`.
|
|
15
|
+
*
|
|
16
|
+
* @param iterable - Optional iterable of key-value pairs.
|
|
17
|
+
* @returns A new Map instance.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createMap: <K, V>(iterable?: Iterable<readonly [K, V]> | null) => Map<K, V>;
|
|
20
|
+
/**
|
|
21
|
+
* (Safe copy) Groups elements by key using the captured Map.groupBy if available.
|
|
22
|
+
* Note: Available only in ES2024+ environments.
|
|
23
|
+
*/
|
|
24
|
+
export declare const mapGroupBy: any;
|
|
25
|
+
/**
|
|
26
|
+
* (Safe copy) Namespace object containing Map factory.
|
|
27
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
28
|
+
*/
|
|
29
|
+
export declare const Map: Readonly<{
|
|
30
|
+
readonly create: <K, V>(iterable?: Iterable<readonly [K, V]> | null) => Map<K, V>;
|
|
31
|
+
readonly groupBy: any;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,WAAW,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,KAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CACrB,CAAA;AAEjE;;;GAGG;AAEH,eAAO,MAAM,UAAU,KAAsB,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,GAAG;sBAdU,CAAC,EAAE,CAAC,aAAa,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,KAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;;EAiBrF,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe copies of Map built-in via factory function.
|
|
3
|
+
*
|
|
4
|
+
* Since constructors cannot be safely captured via Object.assign, this module
|
|
5
|
+
* provides a factory function that uses Reflect.construct internally.
|
|
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/map
|
|
11
|
+
*/
|
|
12
|
+
// Capture references at module initialization time
|
|
13
|
+
const _Map = globalThis.Map;
|
|
14
|
+
const _Reflect = globalThis.Reflect;
|
|
15
|
+
const _freeze = globalThis.Object.freeze;
|
|
16
|
+
/**
|
|
17
|
+
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
18
|
+
* Use this instead of `new Map()`.
|
|
19
|
+
*
|
|
20
|
+
* @param iterable - Optional iterable of key-value pairs.
|
|
21
|
+
* @returns A new Map instance.
|
|
22
|
+
*/
|
|
23
|
+
const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []);
|
|
24
|
+
/**
|
|
25
|
+
* (Safe copy) Groups elements by key using the captured Map.groupBy if available.
|
|
26
|
+
* Note: Available only in ES2024+ environments.
|
|
27
|
+
*/
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
const mapGroupBy = _Map.groupBy;
|
|
30
|
+
/**
|
|
31
|
+
* (Safe copy) Namespace object containing Map factory.
|
|
32
|
+
* Note: Importing this imports all methods in this namespace (no tree-shaking).
|
|
33
|
+
*/
|
|
34
|
+
const Map = _freeze({
|
|
35
|
+
create: createMap,
|
|
36
|
+
groupBy: mapGroupBy,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { Map, createMap, mapGroupBy };
|
|
40
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;AAUG;AAEH;AACA,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG;AAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AACnC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM;AAExC;;;;;;AAMG;AACI,MAAM,SAAS,GAAG,CAAO,QAA2C,KAC9D,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE;AAEhE;;;AAGG;AACH;AACO,MAAM,UAAU,GAAS,IAAK,CAAC;AAEtC;;;AAGG;AACI,MAAM,GAAG,GAAG,OAAO,CAAQ;AAChC,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,OAAO,EAAE,UAAU;AACpB,CAAA;;;;"}
|