Class JS5Object

    • Constructor Detail

      • JS5Object

        public JS5Object()
        Object Object()

        Creates a new object instance

        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
      • JS5Object

        public JS5Object​(JSObject value)
        Object Object(value)
        Parameters:
        value - optional argument specifies a primitive JavaScript value - a number, boolean etc..
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
    • Method Detail

      • create

        public static JS5Object create​(JS5Object proto,
                                       JS5Object descriptors)
        function create(proto, descriptors) create an object with specified prototype and properties.

        Example

         var p = Object.create({z:0}), {
           x: { value: 1, writable, false, enumerable:true. configurable:true},
           y: { value: 2, writable, false, enumerable:true. configurable:true},
         });
         
        Parameters:
        proto - The prototype of the newly created object, or null.
        descriptors - An optional object that maps property names to property descriptors.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, defineProperty(), defineProperties(), getOwnPropertyDescriptor()
      • defineProperties

        public static JS5Object defineProperties​(JS5Object o,
                                                 JS5Object descriptors)
        function defineProperties(o, descriptors) create or configure multiple object properties.

        Example

         var p = Object.defineProperties({}), {
           x: { value: 1, writable, false, enumerable:true. configurable:true},
           y: { value: 2, writable, false, enumerable:true. configurable:true},
         });
         
        Parameters:
        o - The object on which properties are to be created or configured.
        descriptors - An object that maps property names to property descriptors.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, create(), defineProperty(), getOwnPropertyDescriptor()
      • defineProperty

        public static JS5Object defineProperty​(JS5Object o,
                                               JS5String name,
                                               JS5Object desc)
        function defineProperty(o, name, desc) create or configure an object property.

        Example

         function constant(o, n, v) { //define a constant with value v
           Object.defineProperty (o, n, { value: v, writable, false, enumerable:true. configurable:true});
         }
         
        Parameters:
        o - The object on which a property is to be created or configured.
        name - The name of the property created or configured.
        desc - A property descriptor object that describes the new property.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object
      • getOwnPropertyDescriptor

        public static JS5Object getOwnPropertyDescriptor​(JS5Object o,
                                                         JS5String name)
        function getOwnPropertyDescriptor(o, name) query property attributes.
        Parameters:
        o - The object that is to have its property attributes queried.
        name - The name of the property to query.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, defineProperty()
      • getOwnPropertyNames

        public static JS5Array getOwnPropertyNames​(JS5Object o)
        function getOwnPropertyNames(o) return the names of non-inherited properties.

        Example

         Object.getOwnPropertyNames([]); //returns [length]: "length" is non enumerable
         
        Parameters:
        o - An object
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, keys()
      • getPrototypeOf

        public static JS5Object getPrototypeOf​(JS5Object o)
        function getPrototypeOf(o) return the prototype of an object

        Example

         var p = {}; //create object
         Object.getPrototypeOf(p); //=> Object.prototype
         var o = Object.create(p); //an object inherited from p
         Object.getPrototypeOf(o); //=> p
         
        Parameters:
        o - An object.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, create()
      • isExtensible

        public static JSBoolean isExtensible​(JS5Object o)
        function isExtensible(o) can new properties be added to an object?

        Example

         var o = {}; //create object
         Object.isExtensible(o); //=> true
         Object.preventExtensions(o); //Make it non-extensible
         Object.isExtensible(o); //=> false
         
        Parameters:
        o - The object to be checked for extensibility
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object
      • keys

        public static JS5Array keys​(JS5Object o)
        function keys(o) return enumerable property names. Example
         Object.keys({x:1, y:2}); // => ["x", "y"]
         
        Parameters:
        o - an object
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, getOwnPropertyNames()
      • preventExtensions

        public static JS5Object preventExtensions​(JS5Object o)
        function preventExtensions(o) don't allow new properties on an object.
        Parameters:
        o - The object is to have its extensibility attribute set.
        Since:
        Standard ECMA-262 5th. Edition
        See Also:
        Object, freeze(), isExtensible(), seal()