Yahoo! UI Library

yui  3.0.0pr2

Yahoo! UI Library > yui > Lang
Search:
 
Filters

static Class Lang

Provides the language utilites and extensions used by the library

Methods

isArray

static boolean isArray ( o )
Determines whether or not the provided object is an array. Testing typeof/instanceof/constructor of arrays across frame boundaries isn't possible in Safari unless you have a reference to the other frame to test against its Array prototype. To handle this case, we test well-known array properties instead. properties.
Parameters:
o <object> The object to test
Returns: boolean
true if o is an array

isBoolean

static boolean isBoolean ( o )
Determines whether or not the provided object is a boolean
Parameters:
o <object> The object to test
Returns: boolean
true if o is a boolean

isDate

static boolean isDate ( o )
Determines whether or not the supplied object is a date instance
Parameters:
o <object> The object to test
Returns: boolean
true if o is a date

isFunction

static boolean isFunction ( o )
Determines whether or not the provided object is a function Note: Internet Explorer thinks certain functions are objects: var obj = document.createElement("object"); Y.Lang.isFunction(obj.getAttribute) // reports false in IE var input = document.createElement("input"); // append to body Y.Lang.isFunction(input.focus) // reports false in IE You will have to implement additional tests if these functions matter to you.
Parameters:
o <object> The object to test
Returns: boolean
true if o is a function

isNull

static boolean isNull ( o )
Determines whether or not the provided object is null
Parameters:
o <object> The object to test
Returns: boolean
true if o is null

isNumber

static boolean isNumber ( o )
Determines whether or not the provided object is a legal number
Parameters:
o <object> The object to test
Returns: boolean
true if o is a number

isObject

static boolean isObject ( o , failfn )
Determines whether or not the provided object is of type object or function
Parameters:
o <object> The object to test
failfn <boolean> fail if the input is a function
Returns: boolean
true if o is an object

isString

static boolean isString ( o )
Determines whether or not the provided object is a string
Parameters:
o <object> The object to test
Returns: boolean
true if o is a string

isUndefined

static boolean isUndefined ( o )
Determines whether or not the provided object is undefined
Parameters:
o <object> The object to test
Returns: boolean
true if o is undefined

isValue

static boolean isValue ( o )
A convenience method for detecting a legitimate non-null value. Returns false for null/undefined/NaN, true for other values, including 0/false/''
Parameters:
o <object> The item to test
Returns: boolean
true if it is not null/undefined/NaN || false

trim

static string trim ( s )
Returns a string without any leading or trailing whitespace. If the input is not a string, the input will be returned untouched.
Parameters:
s <string> the string to trim
Returns: string
the trimmed string


Copyright © 2008 Yahoo! Inc. All rights reserved.