Class Index | File Index

Classes


Built-In Namespace Object

Method Summary
Method Attributes Method Name and Description
<static>  
Object.every(object, callback, context)
Tests whether all elements in the Object pass the test implemented by the provided function
<static>  
Object.filter(object, callback, context)
Creates a new Object with all elements that pass the test implemented by the provided function.
<static>  
Object.forEach(object, callback, context)
Executes a provided function once per object element.
<static>  
Object.getKeys(object)
Get the keys (property names) from an Object as an Array
<static>  
Object.getValues(object)
Get the values from an Object as an Array
 
inherits(parentClass)
Extend a Class with another's prototype to mimic Class inheritance
<static>  
Object.isArray(object)
Convenience method to check if an object is an Array
<static>  
Object.isBoolean(object)
Convenience method to check if an object is a Boolean
<static>  
Object.isDate(object)
Convenience method to check if an object is a Number
<static>  
Object.isElement(object, tag)
Convenience method to check if an object is a DOM Element
<static>  
Object.isFunction(object)
Convenience method to check if an object is a Function
<static>  
Object.isNumber(object)
Convenience method to check if an object is a Number
<static>  
Object.isObject(object)
Convenience method to check if an object is an Object
<static>  
Object.isRegExp(object)
Convenience method to check if an object is a Regular Expression
<static>  
Object.isString(object)
Convenience method to check if an object is a String
<static>  
Object.isUndefined(object)
Convenience method to check if an object is defined
<static>  
Object.map(object, callback, context)
Creates a new Object with the results of calling a provided function on every element in this Object
<static>  
Object.merge(object, updates)
Creates a new Object, by combining the key:value pairs from two Objects
<static>  
Object.serialize(object, seperator)
Serialize an Object into a string.
<static>  
Object.size(object)
Calculate the size of an Object
<static>  
Object.some(object, callback, context)
Tests whether some element in the array passes the test implemented by the provided function
<static>  
Object.toArray(array)
Convert an array-like object into a true Array
<static>  
Object.update(object, updates)
Updates an Object with key:value pairs from another Object
Method Detail
<static> {Boolean} Object.every(object, callback, context)
Tests whether all elements in the Object pass the test implemented by the provided function
Defined in: object.js.
Parameters:
{Object} object
the Object to iterate over
{Function} callback
function to test for each element
{Object} context Optional
to use as this when executing callback
Returns:
{Boolean} true if all elements pass the test implented by callback, false if not
See:
Array#every

<static> {Object} Object.filter(object, callback, context)
Creates a new Object with all elements that pass the test implemented by the provided function.
Defined in: object.js.
Parameters:
{Object} object
the Object to iterate over
{Function} callback
function to test each element of the array
{Object} context Optional
to use as this when executing callback
Returns:
{Object} a new Object with all elements that pass the test implemented by the provided function
See:
Array#filter

<static> Object.forEach(object, callback, context)
Executes a provided function once per object element.
Defined in: object.js.
Object.forEach({'moo':'cow', 'woof':'dog'}, myFunc);
Parameters:
{Object} object
the Object to iterate over
{Function} callback
function to execute for each element
{Object} context Optional
to use as this when executing callback
See:
Array#forEach

<static> {Array} Object.getKeys(object)
Get the keys (property names) from an Object as an Array
Defined in: object.js.
Parameters:
{Object} object
the Object to get the keys (property names) from
Returns:
{Array} the keys (property names) from the object

<static> {Array} Object.getValues(object)
Get the values from an Object as an Array
Defined in: object.js.
Parameters:
{Object} object
the Object to get the values from
Returns:
{Array} the values from the object

inherits(parentClass)
Extend a Class with another's prototype to mimic Class inheritance
Defined in: object.js.
Author: Shelby H. Moore III.
function ClassA(arg) {
    this.prop = arg || false;
}

ClassB.inherits(ClassA);
function ClassB(arg) {
    this.inherits(ClassA);
    this.prop2 = arg || 'default';
}
Parameters:
{Class} parentClass
the Class to inherit from
1...n Optional
Arguments to initiate the parent Class with
See:
Function.prototype.inherits

<static> {Boolean} Object.isArray(object)
Convenience method to check if an object is an Array
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is an Array, false if not

<static> {Boolean} Object.isBoolean(object)
Convenience method to check if an object is a Boolean
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a Boolean, false if not

<static> {Boolean} Object.isDate(object)
Convenience method to check if an object is a Number
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a Number, false if not

<static> {Boolean} Object.isElement(object, tag)
Convenience method to check if an object is a DOM Element
Defined in: object.js.
Parameters:
object
the object to check the type of
tag
Returns:
{Boolean} true if object is a DOM Element, false if not

<static> {Boolean} Object.isFunction(object)
Convenience method to check if an object is a Function
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a Function, false if not

<static> {Boolean} Object.isNumber(object)
Convenience method to check if an object is a Number
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a Number, false if not

<static> {Boolean} Object.isObject(object)
Convenience method to check if an object is an Object
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is an Object, false if not

<static> {Boolean} Object.isRegExp(object)
Convenience method to check if an object is a Regular Expression
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a Regular Expression, false if not

<static> {Boolean} Object.isString(object)
Convenience method to check if an object is a String
Defined in: object.js.
Parameters:
object
the object to check the type of
Returns:
{Boolean} true if object is a String, false if not

<static> {Boolean} Object.isUndefined(object)
Convenience method to check if an object is defined
Defined in: object.js.
Parameters:
object
the object to check
Returns:
{Boolean} true if object is undefined, false if object is defined

<static> {Object} Object.map(object, callback, context)
Creates a new Object with the results of calling a provided function on every element in this Object
Defined in: object.js.
function makePseudoPlural(single) {
    return single.replace(/o/g, "e");
}
var singles = {"human":"foot", "dinner":"goose", "target":"moose"];
var plurals = Object.map(singles, makePseudoPlural); //{"human":"feet", "dinner":"geese", "target":"meese"}
Parameters:
{Object} object
the Object to iterate over
{Function} callback
function that produces an element of the new Object from an element of the current one
{Object} context Optional
to use as this when executing callback
Returns:
{Object} new Object with the results of calling a provided function on every element in this Object
See:
Array#map

<static> {Object} Object.merge(object, updates)
Creates a new Object, by combining the key:value pairs from two Objects
Defined in: object.js.
var obj = {'cow':'moo', 'dog':'woof'};
var obj2 = Object.merge(obj, {'cow':'milk','sheep':'wool'});
//obj2 == {'cow':'milk', 'dog':'woof', 'sheep':'wool'}
//obj is unchanged
Parameters:
{Object} object
the first of the Objects to merge
{Object} updates
the second of the Objects to merge
Returns:
{Object} new Object updated with new key:value pairs
See:
Object.update

<static> {String} Object.serialize(object, seperator)
Serialize an Object into a string. If the value of a property is an array, the entries will be added multiple times
Defined in: object.js.
Parameters:
{Object} object
the data object to serialize
{String} seperator Optional, Default: '&'
the seperator to use between the values in the generated string
Returns:
{String} the serialized version of the data

<static> {Number} Object.size(object)
Calculate the size of an Object
Defined in: object.js.
Parameters:
object
the object to get the size of
Returns:
{Number} the size of the object

<static> {Boolean} Object.some(object, callback, context)
Tests whether some element in the array passes the test implemented by the provided function
Defined in: object.js.
Parameters:
{Object} object
the Object to iterate over
{Function} callback
function to test for each element
{Object} context Optional
to use as this when executing callback
Returns:
{Boolean} true if some element passes the test implented by callback, false if not
See:
Array#some

<static> {Array} Object.toArray(array)
Convert an array-like object into a true Array
Defined in: object.js.
function foo() {
    var args = Object.toArray(arguments); ['moo','cow']
    args.forEach(someOtherFunc);
}
foo('moo', 'cow');
Parameters:
{Array-like} array
array-like object to create true Array from
Returns:
{Array} new Array created from original object

<static> {Object} Object.update(object, updates)
Updates an Object with key:value pairs from another Object
Defined in: object.js.
var obj = {'cow':'moo', 'dog':'woof'};
Object.update(obj, {'cow':'milk','sheep':'wool'}); //{'cow':'milk', 'dog':'woof', 'sheep':'wool'}
Parameters:
{Object} object
the Object to update
{Object} updates
the new key:value pairs to update the original Object with
Returns:
{Object} the original Object updated with new key:value pairs
See:
Object.merge

Documentation generated by JsDoc Toolkit 2.1.0 on Tue Feb 03 2009 04:12:53 GMT+1100 (EST)