The js.lib.Object constructor creates an object wrapper.

Documentation Object by Mozilla Contributors, licensed under CC-BY-SA 2.5.

Static variables

staticread onlyprototype:ObjectPrototype

Allows the addition of properties to all objects of type Object.

Static methods

staticassign<TSource, TDest>(target:TSource, sources:Rest<{}>):TDest

The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.

Note: this is an ES2015 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

staticcreate<T>(proto:Null<{}>, ?propertiesObject:DynamicAccess<ObjectPropertyDescriptor<Any>>):T

The Object.create() method create a new object, using an existing object to provide the newly created object's proto . (see browser console for visual evidence.)

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

staticdefineProperties<T>(obj:T, props:DynamicAccess<ObjectPropertyDescriptor<Any>>):T

The Object.defineProperties() method defines new or modifies existing properties directly on an object, returning the object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

staticdefineProperty<T, TProp>(obj:T, prop:String, descriptor:ObjectPropertyDescriptor<TProp>):T

staticdefineProperty<T, TProp>(obj:T, prop:Symbol, descriptor:ObjectPropertyDescriptor<TProp>):T

The static method Object.defineProperty() defines a new property directly on an object, or modifies an existing property on an object, and returns the object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

staticentries<T>(obj:T):Array<ObjectEntry>

The Object.entries() method returns an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).

Note: this is an ES2017 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

staticfreeze<T>(obj:T):T

The Object.freeze() method freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed, it also prevents the prototype from being changed. The method returns the passed object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze

staticfromEntries<T>(iterable:Any):T

Returns a new object from an iterable of key-value pairs (reverses Object.entries).

staticgetOwnPropertyDescriptor<T, TProp>(obj:T, prop:String):Null<ObjectPropertyDescriptor<TProp>>

staticgetOwnPropertyDescriptor(obj:String, prop:Symbol):Null<ObjectPropertyDescriptor<String>>

staticgetOwnPropertyDescriptor(obj:String, prop:String):Null<ObjectPropertyDescriptor<String>>

staticgetOwnPropertyDescriptor<T>(target:Array<T>, propertyKey:Int):Null<ObjectPropertyDescriptor<T>>

staticgetOwnPropertyDescriptor<T, TProp>(obj:T, prop:Symbol):Null<ObjectPropertyDescriptor<TProp>>

The Object.getOwnPropertyDescriptor() method returns a property descriptor for an own property (that is, one directly present on an object and not in the object's prototype chain) of a given object.

In ES5, if the first argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object first argument will be coerced to an object at first.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor

staticgetOwnPropertyDescriptors<T>(obj:T):DynamicAccess<ObjectPropertyDescriptor<Any>>

staticgetOwnPropertyDescriptors(target:String):DynamicAccess<ObjectPropertyDescriptor<String>>

staticgetOwnPropertyDescriptors<T>(target:Array<T>):DynamicAccess<ObjectPropertyDescriptor<T>>

The Object.getOwnPropertyDescriptors() method returns all own property descriptors of a given object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors

staticgetOwnPropertyNames<T>(obj:T):Array<String>

The Object.getOwnPropertyNames() method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found directly upon a given object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames

staticgetOwnPropertySymbols<T>(obj:T):Array<Symbol>

The Object.getOwnPropertySymbols() method returns an array of all symbol properties found directly upon a given object.

Note: this is an ES2015 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols

staticgetPrototypeOf<T, TProto>(obj:T):TProto

The Object.getPrototypeOf() method returns the prototype (i.e. the value of the internal [[Prototype]] property) of the specified object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf

staticis<T>(obj1:T, obj2:T):Bool

Deprecated: "Use Object.isSame()"

The Object.is() method determines whether two values are the same value.

Note: this is an ES2015 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is

staticisExtensible<T>(obj:T):Bool

The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it).

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible

staticisFrozen<T>(obj:T):Bool

The Object.isFrozen() determines if an object is frozen.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen

@:native("is")staticisSame<T>(obj1:T, obj2:T):Bool

The Object.is() method determines whether two values are the same value.

Note: this is an ES2015 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is

staticisSealed<T>(obj:T):Bool

The Object.isSealed() method determines if an object is sealed.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed

statickeys<T>(obj:T):Array<String>

The Object.keys() method returns an array of a given object's own enumerable properties, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys

staticpreventExtensions<T>(obj:T):T

The Object.preventExtensions() method prevents new properties from ever being added to an object (i.e. prevents future extensions to the object).

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions

staticseal<T>(obj:T):T

The Object.seal() method seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal

staticsetPrototypeOf<T, TProto>(obj:T, proto:Null<TProto>):T

The Object.setPrototypeOf() method sets the prototype (i.e., the internal [[Prototype]] property) of a specified object to another object or null.

Note: this is an ES2015 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf

staticvalues<T>(obj:T):Array<Any>

The Object.values() method returns an array of a given object's own enumerable property values, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well).

Note: this is an ES2017 feature

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values

Constructor

new(?value:Any)

The Object constructor creates an object wrapper.