isArray
static
boolean
isArray
(
o
)
Determines whether or not the provided item is an array.
Returns false for array-like collections such as the
function arguments collection or HTMLElement collection
will return false. You can use @see Array.test if you
want to
- 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 item 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 item 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 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.
- 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 item 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 item 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 item 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 item 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 item 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
type
string
type
(
o
)
Returns a string representing the type of the item passed in.
- Parameters:
-
o <object>
the item to test
- Returns:
string
- the detected type