Signature: isAssociative(value:Any)
Returns a boolean indicating whether or not the value is an associative object.
An associative object is one where its elements can be accessed via a key or
index (e.g. arrays, arguments
, objects).
_.isAssociative(["Athens", "Sparta"]);
// => true
_.isAssociative(42);
// => false
Signature: _.isDecreasing(values:Any...)
Checks whether the arguments are monotonically decreasing values (i.e. whether each argument is less than the previous argument.)
_.isDecreasing(3, 2, 1);
// => true
_.isDecreasing(15, 12, 2);
// => true
_.isDecreasing(2, 3);
// => false
Signature: _.isEven(value:Any)
Checks whether the value is an even number.
_.isEven(12);
// => true
_.isEven(3);
// => false
_.isEven({});
// => false
Signature: _.isFloat(value:Any)
Checks whether the value is a "float." For the purposes of this function, a float
is a numeric value that is not an integer. A numeric value may be a number, a
string containing a number, a Number
object, etc.
NOTE: JavaScript itself makes no distinction between integers and floats. For
the purposes of this function both 1
and 1.0
are considered integers.
_.isFloat(1.1);
// => true
_.isFloat(1);
// => false
_.isFloat(1.0);
// => false
_.isFloat("2.15");
// => true
Signature: _.isIncreasing(value:Any...)
Checks whether the arguments are monotonically increasing values (i.e. each argument is greater than the previous argument.)
_.isIncreasing(1, 12, 15);
// => true
_.isIncreasing(1);
// => true
_.isIncreasing(5, 4);
// => false
Signature: _.isIndexed(value:Any)
Checks whether the value is "indexed." An indexed value is one which accepts a numerical index to access its elements. (e.g. arrays and strings)
NOTE: lodash does not support cross-browser consistent use of strings as array-like values, so be wary in IE 8 when using string objects and in IE7 and earlier when using string literals & objects.
_.isIndexed("Socrates");
// => true
_.isIndexed({poison: "hemlock"});
// => false
Signature: _.isInstanceOf(value:Any, constructor:Function)
Checks whether the value is an instance of the constructor.
_.isInstanceOf(new Date(), Date);
// => true
_.isInstanceOf("Hippocrates", RegExp);
// => false
Signature: _.isInteger(value:Any)
Checks whether the value is a numeric integer. A numeric value can be a string
containing a number, a Number
object, etc.
_.isInteger(18);
// => true
_.isInteger("18");
// => true
_.isInteger(2.5);
// => false
_.isInteger(-1);
// => true
Signature: _.isJSON(value:Any)
Checks whether the value is valid JSON. See the spec for more information on what constitutes valid JSON.
NOTE: This function relies on JSON.parse
which is not available in IE7 and
earlier.
_.isJSON('{ "name": "Crockford" }');
// => true
_.isJSON({ name: "Crocket" });
// => false
Signature: _.isNegative(value:Any)
Checks whether the value is a negative number.
_.isNegative(-2);
// => true
_.isNegative(5);
// => false
Signature: _.isNumeric(value:Any)
A numeric is something that contains a numeric value, regardless of its type. It
can be a string containing a numeric value, exponential notation, a Number
object, etc.
_.isNumeric("14");
// => true
_.isNumeric("fourteen");
// => false
Signature: _.isOdd(value:Any)
Checks whether the value is an odd number.
_.isOdd(3);
// => true
_.isOdd(2);
// => false
_.isOdd({});
// => false
Signature: _.isPlainObject(value:Any);
Checks whether the value is a "plain" object created as an object literal ({}
)
or explicitly constructed with new Object()
. Instances of other constructors
are not plain objects.
_.isPlainObject({});
// => true
_.isPlainObject(new Date());
// => false
_.isPlainObject([]);
// => false
Signature: _.isPositive(value:Any)
Checks whether the value is a positive number.
_.isPositive(21);
// => true
_.isPositive(-3);
// => false
Signature: _.isSequential(value:Any)
Checks whether the value is a sequential composite type (i.e. arrays and
arguments
).
_.isSequential(["Herodotus", "Thucidydes");
// => true
_.isSequential(new Date);
// => false
Signature: _.isValidDate(value:Any)
Checks whether the value is a valid date. That is, the value is both an instance
of Date
and it represents an actual date.
_.isValidDate(new Date("January 1, 1900"));
// => true
_.isValidDate(new Date("The Last Great Time War"));
// => false
Signature: _.isZero(value:Any)
Checks whether the value is 0
.
_.isZero(0);
// => true
_.isZero("Pythagoras");
// => false