Object object

Despite of its name Object is a class that contains methods of objects in script. For example here last line here will be evaluated to true:

var obj = { one:1, two:2 }; // creating object from literal
if( obj instanceof Object )
      stdout.printf( "I am an instance of Object" ); // will output this

Properties

className
readonly, string. Name of the class if object was created as instance of user defined class.
length
readonly, integer. Returns total number of members that this instance of object owns.

Methods

this
( )

constructor, creates instance of Object class - object per se.

toString
toLocaleString
( ) : string

Returns string "[object Object]".

valueOf
( ) : value

Returns object itself.

clone
( [deep:true] ) : object

Makes copy of the object and returns it. If deep === true then it does recursive, deep cloning.

extend
( [deep:true], object1, object2, ...  ) : this

Extends the object by merging its properties from properties of object1, object2, etc.

eval
( what: string | Stream [, namespace: object] ): value

Evaluates (interprets) what with context of this equal to the object. If namespace object is given then it is used as global namespace for evaluated code.

Static methods

Object.keys
( obj ) : array      

Returns list of property names defined on the object itself.

Object.create
( proto: class | object | null, [ propertiesObject: object ] : object

Creates a new object, using an existing object as the prototype of the newly created object.

If propertiesObject is provided then its properties are copied into newly created object.

Returns created object.

Object.assign
( target: object, source: object, ... source: object : object

Copies the values of all own properties from one or more source objects to the target object.

Returns the target object.

Object.seal
( obj, [strict:true|false] ) : object

Locks structure of the object - after the call any attempt to add or remove object's property will throw an error. Values of existing properties can be changed though. Returns the object itself. If strict parameter is provided and it is exactly true then any attempt to get unknown property will throw an error.

Object.isSealed
(obj, [strict:true|false] ) : true | false | undefined

Returns true if the object is sealed. If strict parameter is provided and is exactly true then the method returns true only if seal(true) was called for it.

Object.freeze
(obj, [strict:true|false] ) : object

Locks the object - makes it immutable - any attempt to add, remove and modify value of any object's property will throw an error. Returns the object itself. If there is a strict parameter and it is exactly true then any attempt to get unknown property will throw an error.

Object.isFrozen
(obj, [strict:true|false] ) : true | false | undefined

Returns true if the object is frozen. If strict parameter is provided and is exactly true then the method returns true only if freeze(true) was called for it.

Object.addObserver
(obj, observer:function ) : undefined

Attaches observer to the object - function that is called when the object changes. The observer here is a function that has following signature:

function observer(changeDefinition) {} where changeDefinition is tuple having following fields:

Object.removeObserver
(obj, observer:function | functionName:symbol ) : undefined

Detaches given observer function from the object by function reference or by its name.  

Object.referenceOf
( namespace:object, path:string ) : (collection:object, key:symbol|string)

When given dot separated path like "one.two.three" the function returns obj/key pair - object in which "three" key is defined and that key.