@hyperfrontend/immutable-api-utils/built-in-copy/objectobject
Locked, prototype-pollution-resistant copies of the global Object static methods.
References to Object.freeze, Object.create, Object.keys, Object.values, Object.entries, Object.assign, Object.defineProperty, and the rest of the Object static surface are captured at module-load time and frozen into a tamper-proof namespace, so downstream code keeps working even if the global Object 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) Safe wrapper for Object.prototype.hasOwnProperty.call(). Checks if an object has a property as its own (not inherited) property.
Parameters
Returns
booleanTrue if the object has the property as its own property.
Example
Checking own properties
const user = { name: 'Alice' }
hasOwn(user, 'name') // => true
hasOwn(user, 'toString') // => false (inherited from prototype)(Safe copy) Safe wrapper for Object.prototype.toString.call(). Returns the internal [[Class]] property of the object as a string tag.
Parameters
| Name | Type | Description |
|---|---|---|
§value | unknown | The value to get the type tag from. |
Returns
stringThe type tag string (e.g., "[object Array]").
Example
Getting type tags
typeTag([1, 2, 3]) // => '[object Array]'
typeTag(null) // => '[object Null]'
typeTag(Promise.resolve()) // => '[object Promise]'● Variables
(Safe copy) Copy the values of all enumerable own properties from one or more source objects to a target object. Returns the target object.
(Safe copy) Creates an object that has the specified prototype or that has null prototype.
(Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
(Safe copy) Adds a property to an object, or modifies attributes of an existing property.
(Safe copy) Returns an array of key/values of the enumerable own properties of an object.
(Safe copy) Prevents modification of existing property attributes and values, and prevents the addition of new properties.
(Safe copy) Returns an object from an iterable of key-value pairs.
(Safe copy) Gets the own property descriptor of the specified object.
(Safe copy) Gets the own property descriptors of the specified object.
(Safe copy) Returns the names of the own properties of an object.
(Safe copy) Returns an array of all symbol properties found directly on object o.
(Safe copy) Returns the prototype of an object.
(Safe copy) Returns a value that indicates whether new properties can be added to an object.
(Safe copy) Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.
(Safe copy) Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.
(Safe copy) Returns the names of the enumerable string properties and methods of an object.
(Safe copy) Determines whether an object has a property with the specified name.
(Safe copy) Prevents the addition of new properties to an object.
(Safe copy) Namespace object containing all Object static methods. Note: Importing this imports all methods in this namespace (no tree-shaking). Named SafeObject instead of Object to avoid shadowing global Object during CJS module initialization.
(Safe copy) Prevents the addition of new properties to an object.
(Safe copy) Sets the prototype of a specified object o to object proto or null.
(Safe copy) Returns an array of values of the enumerable own properties of an object.