Yahoo! UI Library

YAHOO Global  2.2.0

Yahoo! UI Library > yahoo > YAHOO.lang

Class YAHOO.lang

Provides the language utilites and extensions used by the library

Methods

augment

static void augment ( r , s , arguments )
Applies all prototype properties in the supplier to the receiver if the receiver does not have these properties yet. Optionally, one or more methods/properties can be specified (as additional parameters). This option will overwrite the property if receiver has it already.
Parameters:
r <Function> the object to receive the augmentation
s <Function> the object that supplies the properties to augment
arguments <String*> zero or more properties methods to augment the receiver with. If none specified, everything in the supplier will be used unless it would overwrite an existing property in the receiver
Returns: void

extend

static void extend ( subc , superc , overrides )
Utility to set up the prototype, constructor and superclass properties to support an inheritance strategy that can chain constructors and methods.
Parameters:
subc <Function> the object to modify
superc <Function> the object to inherit
overrides <Object> additional properties/methods to add to the subclass prototype. These will override the matching items obtained from the superclass if present.
Returns: void

hasOwnProperty

void hasOwnProperty ( obj )
Determines whether or not the property was added to the object instance. Returns false if the property is not present in the object, or was inherited from the prototype. This abstraction is provided to enable hasOwnProperty for Safari 1.3.x. There is a discrepancy between YAHOO.lang.hasOwnProperty and Object.prototype.hasOwnProperty when the property is a primitive added to both the instance AND prototype with the same value:
var A = function() {};
A.prototype.foo = 'foo';
var a = new A();
a.foo = 'foo';
alert(a.hasOwnProperty('foo')); // true
alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isArray

void isArray ( obj )
Determines whether or not the provided object is an array
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isBoolean

void isBoolean ( obj )
Determines whether or not the provided object is a boolean
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isFunction

void isFunction ( obj )
Determines whether or not the provided object is a function
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isNull

void isNull ( obj )
Determines whether or not the provided object is null
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isNumber

void isNumber ( obj )
Determines whether or not the provided object is a legal number
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isObject

void isObject ( obj )
Determines whether or not the provided object is of type object or function
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isString

void isString ( obj )
Determines whether or not the provided object is a string
Parameters:
obj <any> The object being testing
Returns: void
Boolean

isUndefined

void isUndefined ( obj )
Determines whether or not the provided object is undefined
Parameters:
obj <any> The object being testing
Returns: void
Boolean


Copyright © 2007 Yahoo! Inc. All rights reserved.