lodash.isarray
Advanced tools
Comparing version 3.0.3 to 3.0.4
106
index.js
/** | ||
* lodash 3.0.3 (Custom Build) <https://lodash.com/> | ||
* lodash 3.0.4 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
@@ -14,10 +14,2 @@ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
/** | ||
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). | ||
* In addition to special characters the forward slash is escaped to allow for | ||
* easier `eval` use and `Function` compilation. | ||
*/ | ||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, | ||
reHasRegExpChars = RegExp(reRegExpChars.source); | ||
/** Used to detect host constructors (Safari > 5). */ | ||
@@ -27,17 +19,2 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
/** | ||
* Converts `value` to a string if it's not one. An empty string is returned | ||
* for `null` or `undefined` values. | ||
* | ||
* @private | ||
* @param {*} value The value to process. | ||
* @returns {string} Returns the string. | ||
*/ | ||
function baseToString(value) { | ||
if (typeof value == 'string') { | ||
return value; | ||
} | ||
return value == null ? '' : (value + ''); | ||
} | ||
/** | ||
* Checks if `value` is object-like. | ||
@@ -63,3 +40,3 @@ * | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -71,3 +48,3 @@ */ | ||
var reIsNative = RegExp('^' + | ||
escapeRegExp(fnToString.call(hasOwnProperty)) | ||
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
@@ -80,3 +57,3 @@ ); | ||
/** | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
@@ -102,3 +79,3 @@ */ | ||
* | ||
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). | ||
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
* | ||
@@ -134,2 +111,52 @@ * @private | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
* @example | ||
* | ||
* _.isFunction(_); | ||
* // => true | ||
* | ||
* _.isFunction(/abc/); | ||
* // => false | ||
*/ | ||
function isFunction(value) { | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in older versions of Chrome and Safari which return 'function' for regexes | ||
// and Safari 8 equivalents which return 'object' for typed array constructors. | ||
return isObject(value) && objToString.call(value) == funcTag; | ||
} | ||
/** | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
* @example | ||
* | ||
* _.isObject({}); | ||
* // => true | ||
* | ||
* _.isObject([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObject(1); | ||
* // => false | ||
*/ | ||
function isObject(value) { | ||
// Avoid a V8 JIT bug in Chrome 19-20. | ||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
var type = typeof value; | ||
return !!value && (type == 'object' || type == 'function'); | ||
} | ||
/** | ||
* Checks if `value` is a native function. | ||
@@ -154,3 +181,3 @@ * | ||
} | ||
if (objToString.call(value) == funcTag) { | ||
if (isFunction(value)) { | ||
return reIsNative.test(fnToString.call(value)); | ||
@@ -161,23 +188,2 @@ } | ||
/** | ||
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", | ||
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category String | ||
* @param {string} [string=''] The string to escape. | ||
* @returns {string} Returns the escaped string. | ||
* @example | ||
* | ||
* _.escapeRegExp('[lodash](https://lodash.com/)'); | ||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)' | ||
*/ | ||
function escapeRegExp(string) { | ||
string = baseToString(string); | ||
return (string && reHasRegExpChars.test(string)) | ||
? string.replace(reRegExpChars, '\\$&') | ||
: string; | ||
} | ||
module.exports = isArray; |
{ | ||
"name": "lodash.isarray", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "The modern build of lodash’s `_.isArray` as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.isarray v3.0.3 | ||
# lodash.isarray v3.0.4 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.isArray` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [documentation](https://lodash.com/docs#isArray) or [package source](https://github.com/lodash/lodash/blob/3.0.3-npm-packages/lodash.isarray) for more details. | ||
See the [documentation](https://lodash.com/docs#isArray) or [package source](https://github.com/lodash/lodash/blob/3.0.4-npm-packages/lodash.isarray) for more details. |
7857
163