@hyperfrontend/immutable-api-utils/built-in-copy/functionfunction
Locked, prototype-pollution-resistant copy of the global Function constructor and its prototype helpers.
The Function constructor is wrapped in a createFunction factory and Function.prototype.call, apply, and bind are captured at module-load time and frozen into a tamper-proof namespace, so reflective invocation keeps working even if the global Function is later patched. Effective only when imported before any untrusted code has had a chance to mutate the prototype chain.
API Reference
ƒ Functions
(Safe copy) Creates a new Function using the captured Function constructor. Use this instead of
NOTE: Dynamic code generation via Function constructor should be avoided when possible due to security risks similar to eval().
new Function(). NOTE: Dynamic code generation via Function constructor should be avoided when possible due to security risks similar to eval().
Parameters
| Name | Type | Description |
|---|---|---|
§...args | string[] | Function body and parameter strings. |
Returns
(args: unknown[]) => unknownA new Function.
● Variables
(Safe copy) Namespace object containing Function utilities. Note: Importing this imports all methods in this namespace (no tree-shaking).
(Safe copy) Reference to the captured Function.prototype.apply.
(Safe copy) Reference to the captured Function.prototype.bind.
(Safe copy) Reference to the captured Function.prototype.call.
(Safe copy) Reference to the captured Function.prototype.