Namespace: Object

utilx. Object

utilx.Object
Source:

Methods

(static) areSameClass(a, …bopt) → {boolean}

Returns true if the operands are of the same object class.
Parameters:
Name Type Attributes Description
a *
b * <optional>
<repeatable>
Source:
Returns:
Type
boolean

(static) areSameTypeOf(a, …bopt) → {boolean}

Returns true if the operands are of the same typeof.
Parameters:
Name Type Attributes Description
a *
b * <optional>
<repeatable>
Source:
Returns:
Type
boolean

(static) assign(target, …source) → {Object}

The assign function is used to copy the values of all of the enumerable own properties from a source object to a target object.
Parameters:
Name Type Attributes Description
target Object
source Object <repeatable>
Source:
See:
Returns:
Type
Object

(static) CheckObjectCoercible(inputArg) → {*}

The abstract operation throws an error if its argument is a value that cannot be converted to an Object, otherwise returns the argument.
Parameters:
Name Type Description
inputArg *
Source:
See:
Throws:
if inputArg is null or {@link undefined}.
Type
TypeError
Returns:
Type
*

(static) create(prototype) → {Object}

The $.Object.create method creates a new object with the specified prototype object and properties.
Parameters:
Name Type Description
prototype Prototype
Source:
See:
Returns:
Type
Object

(static) deepEqual(a, b) → {boolean}

Tests a deep equality relation.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) deepFreeze(object) → {Object}

To make object fully immutable, freeze each object in object.
Parameters:
Name Type Description
object Object
Source:
See:
Returns:
Type
Object

(static) deepStrictEqual(a, b) → {boolean}

Tests a deep equality relation.
Parameters:
Name Type Description
a *
b *
Source:
Returns:
Type
boolean

(static) defineProperties(object, props) → {Object}

Defines new or modifies existing properties directly on an object, returning the object.
Parameters:
Name Type Description
object Object
props string
Source:
See:
Returns:
Type
Object

(static) defineProperty(object, property, descriptor) → {Object}

Defines a new property directly on an object, or modifies an existing property on an object, and returns the object.
Parameters:
Name Type Description
object Object
property string
descriptor Object
Source:
See:
Returns:
Type
Object

(static) equal(a, b) → {boolean}

Returns true if the operands are loosely equal.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) forKeys(object, fn, thisArgopt) → {boolean}

Executes a provided function once per object property and allows a some like break.
Parameters:
Name Type Attributes Description
object object
fn forKeysCallback
thisArg * <optional>
Source:
Throws:
  • if object is primitive
    Type
    TypeError
  • if fn is not a function
    Type
    TypeError
Returns:
Type
boolean

(static) freeze(object) → {Object}

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. In essence the object is made effectively immutable. Returns the object being frozen.
Parameters:
Name Type Description
object Object
Source:
See:
Returns:
Type
Object

(static) getOwnPropertyDescriptor(object, property) → {Object}

Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object. On environments that do not support it natively, this is just a sham to allow code to work.
Parameters:
Name Type Description
object Object
property string
Source:
See:
Returns:
Type
Object

(static) getPrototypeOf(object) → {Prototype}

Return the value of the [[Prototype]] internal property of object. Actually based on the ECMA6 draft, which only throws on undefined or null.
Parameters:
Name Type Description
object Object
Source:
See:
Returns:
Type
Prototype

(static) gt(a, b) → {boolean}

Returns true if the operand number is greater than limit.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) gte(a, b) → {boolean}

Returns true if the operand number is greater than or equal to limit.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) has(object, property) → {boolean}

Returns true if the specified property is in the specified object.
Parameters:
Name Type Description
object Object The object that has was called upon.
property StringLike A string or numeric expression representing a property name or array index.
Source:
See:
Returns:
Type
boolean

(static) hasOwn(object, property) → {boolean}

Returns a boolean indicating whether the object has the specified property. This function can be used to determine whether an object has the specified property as a direct property of that object; unlike the $.Object.has function, this method does not check down the object's prototype chain.
Parameters:
Name Type Description
object Object
property StringLike
Source:
See:
Returns:
Type
boolean

(static) instanceOf(object, ctr) → {boolean}

The function tests whether an object has in its prototype chain the prototype property of a constructor.
Parameters:
Name Type Description
object Object
ctr function
Source:
See:
Returns:
Type
boolean

(static) is(xopt, yopt) → {boolean}

Determines whether two values are the same value.
Parameters:
Name Type Attributes Description
x * <optional>
y * <optional>
Source:
See:
Returns:
Type
boolean

(static) isArguments(inputArg) → {boolean}

Returns true if the operand inputArg is an arguments object.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isEmpty(inputArg) → {boolean}

Check to see if an object is empty (contains no enumerable properties). Some gotchas to watch for, not all browsers agree on what properties are enumerable: IE 6 to 9: Error: description, message IE 10: Error: description FF 3 to 5: Error: message, fileName, lineNumber, stack FF 3 to 3.5: Function: prototype Chrome 5 to 9: Error: message, stack Chrome 10 to 13: Error: arguments, type, message, stack V8 Error object has: captureStackTrace, stackTraceLimit Opera 10 to 12 & next: Error: message Opera 11.5: Function: prototype Safari 4 to 6 & next: Error: message There are most probably other native objects that do not agree: Object and Array should be fine in all environments..
Parameters:
Name Type Description
inputArg Object
Source:
Returns:
Type
boolean

(static) isFalsy(inputArg) → {boolean}

Returns true if the operand inputArg is a falsy.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isFrozen(object) → {boolean}

Determine if an object is frozen.
Parameters:
Name Type Description
object Object
Source:
See:
Returns:
Type
boolean

(static) isNotPrimitive(inputArg) → {boolean}

Returns true if the operand inputArg is not a primitive object.
Parameters:
Name Type Description
inputArg *
Source:
See:
Returns:
Type
boolean

(static) isnt(xopt, yopt) → {boolean}

Determines whether two values are not the same value.
Parameters:
Name Type Attributes Description
x * <optional>
y * <optional>
Source:
See:
Returns:
Type
boolean

(static) isNull(inputArg) → {boolean}

Returns true if the operand inputArg is null.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isNumeric(inputArg) → {boolean}

Returns true if the operand inputArg is deemed numeric.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isObject(inputArg) → {boolean}

Returns true if the operand inputArg is an Object.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isPlainObject(object) → {boolean}

Check to see if an object is a plain object (created using "{}" or "new Object"). Some gotchas, not all browsers are equal and native objects do not necessarily abide by the rules.
Parameters:
Name Type Description
object Object
Source:
Returns:
Type
boolean

(static) isPrimitive(inputArg) → {boolean}

Returns true if the operand inputArg is a primitive object.
Parameters:
Name Type Description
inputArg *
Source:
See:
Returns:
Type
boolean

(static) isTruthy(inputArg) → {boolean}

Returns true if the operand inputArg is a truthy.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isTypeObject(inputArg) → {boolean}

Returns true if the operand inputArg is of type Object but not if null.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isTypeOfObject(inputArg) → {boolean}

Returns true if the operand inputArg is typeof Object.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isUndefined(inputArg) → {boolean}

Returns true if the operand inputArg is undefined.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) isUndefinedOrNull(inputArg) → {boolean}

Returns true if the operand inputArg is undefined or null.
Parameters:
Name Type Description
inputArg *
Source:
Returns:
Type
boolean

(static) keys(object) → {Array}

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). Some gotchas to watch for, not all browsers agree on what properties are enumerable: IE 6 to 9: Error: description, message IE 10: Error: description FF 3 to 5: Error: message, fileName, lineNumber, stack FF 3 to 3.5: Function: prototype Chrome 5 to 9: Error: message, stack Chrome 10 to 13: Error: arguments, type, message, stack V8 Error object has: captureStackTrace, stackTraceLimit Opera 10 to 12 & next: Error: message Opera 11.5: Function: prototype Safari 4 to 6 & next: Error: message There are most probably other native objects that do not agree: Object and Array should be fine in all environments.
Parameters:
Name Type Description
object Object
Source:
See:
Returns:
Type
Array

(static) lt(a, b) → {boolean}

Returns true if the operand number is less than limit.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) lte(a, b) → {boolean}

Returns true if the operand number is less than or equal to limit.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) notEqual(a, b) → {boolean}

Returns true if the operands are not loosely equal.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) notStrictEqual(a, b) → {boolean}

Returns true if the operands are not strictly equal with no type conversion.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) strictEqual(a, b) → {boolean}

Returns true if the operands are strictly equal with no type conversion.
Parameters:
Name Type Description
a *
b *
Source:
See:
Returns:
Type
boolean

(static) swapItems(object, prop1, prop2) → {Object}

Swap places of 2 item values on an object's properties.
Parameters:
Name Type Description
object Object
prop1 NumberLike
prop2 NumberLike
Source:
Returns:
Type
Object

(static) ToClassString(inputArg) → {string}

Return the String value that is the result of concatenating the three Strings "[object ", class, and "]". I.e. [[Class]] A String value indicating a specification defined classification of objects.
Parameters:
Name Type Description
inputArg *
Source:
See:
Returns:
Type
string

(static) ToObject(inputArg) → {Object}

The abstract operation converts its argument to a value of type Object
Parameters:
Name Type Description
inputArg *
Source:
See:
Throws:
if inputArg is null or {@link undefined}.
Type
TypeError
Returns:
Type
Object

(static) ToObjectFixIndexedAccess(inputArg) → {Object}

The abstract operation converts its argument to a value of type Object but fixes some environment bugs.
Parameters:
Name Type Description
inputArg *
Source:
See:
Returns:
Type
Object