Provides core language utilites and extensions used throughout YUI.
isArrayo
Determines whether or not the provided item is an array.
Returns false for array-like collections such as the function arguments
collection or HTMLElement collections. Use Y.Array.test() if you want to
test for an array-like collection.
o
Object
isBooleano
Determines whether or not the provided item is a boolean.
o
Object
isDateo
Determines whether or not the supplied item is a date instance.
o
Object
isFunctiono
Determines whether or not the provided item 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.
o
Object
isNullo
Determines whether or not the provided item is null.
o
Object
isNumbero
Determines whether or not the provided item is a legal number.
o
Object
isObjecto
failfn
Determines whether or not the provided item is of type object
or function. Note that arrays are also objects, so
Y.Lang.isObject([]) === true.
isStringo
Determines whether or not the provided item is a string.
o
Object
isUndefinedo
Determines whether or not the provided item is undefined.
o
Object
isValueo
A convenience method for detecting a legitimate non-null value. Returns false for null/undefined/NaN, true for other values, including 0/false/''
o
Object
nowReturns the current time in milliseconds.
subs
o
Lightweight version of Y.substitute. Uses the same template
structure as Y.substitute, but doesn't support recursion,
auto-object coersion, or formats.
trims
Returns a string without any leading or trailing whitespace. If the input is not a string, the input will be returned untouched.
s
String
trimLefts
Returns a string without any leading whitespace.
s
String
trimRights
Returns a string without any trailing whitespace.
s
String
typeo
Returns a string representing the type of the item passed in.
Known issues:
typeof HTMLElementCollection returns function in Safari, but
Y.type() reports object, which could be a good thing --
but it actually caused the logic in Y.Lang.isObject to fail.
o
Object