lodash.isarray
Advanced tools
Comparing version 2.4.1 to 3.0.0
157
index.js
/** | ||
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> | ||
* Build: `lodash modularize modern exports="npm" -o ./npm/` | ||
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <http://lodash.com/license> | ||
* lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
*/ | ||
var isNative = require('lodash._isnative'); | ||
/** `Object#toString` result shortcuts */ | ||
var arrayClass = '[object Array]'; | ||
/** `Object#toString` result references. */ | ||
var arrayTag = '[object Array]', | ||
funcTag = '[object Function]'; | ||
/** Used for native method references */ | ||
/** Used to detect host constructors (Safari > 5). */ | ||
var reHostCtor = /^\[object .+?Constructor\]$/; | ||
/** | ||
* Used to match `RegExp` special characters. | ||
* See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) | ||
* for more details. | ||
*/ | ||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, | ||
reHasRegExpChars = RegExp(reRegExpChars.source); | ||
/** | ||
* Converts `value` to a string if it is 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. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
*/ | ||
function isObjectLike(value) { | ||
return (value && typeof value == 'object') || false; | ||
} | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to resolve the internal [[Class]] of values */ | ||
var toString = objectProto.toString; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var fnToString = Function.prototype.toString; | ||
/* Native method shortcuts for methods with the same name as other `lodash` methods */ | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** Used to detect if a method is native. */ | ||
var reNative = RegExp('^' + | ||
escapeRegExp(objToString) | ||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray; | ||
/** | ||
* Checks if `value` is an array. | ||
* Used as the maximum length of an array-like value. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) | ||
* for more details. | ||
*/ | ||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | ||
/** | ||
* Checks if `value` is a valid array-like length. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
*/ | ||
function isLength(value) { | ||
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
} | ||
/** | ||
* Checks if `value` is classified as an `Array` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @type Function | ||
* @category Objects | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if the `value` is an array, else `false`. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
* @example | ||
* | ||
* _.isArray([1, 2, 3]); | ||
* // => true | ||
* | ||
* (function() { return _.isArray(arguments); })(); | ||
* // => false | ||
* | ||
* _.isArray([1, 2, 3]); | ||
* // => true | ||
*/ | ||
var isArray = nativeIsArray || function(value) { | ||
return value && typeof value == 'object' && typeof value.length == 'number' && | ||
toString.call(value) == arrayClass || false; | ||
return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false; | ||
}; | ||
/** | ||
* Checks if `value` is a native function. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
* @example | ||
* | ||
* _.isNative(Array.prototype.push); | ||
* // => true | ||
* | ||
* _.isNative(_); | ||
* // => false | ||
*/ | ||
function isNative(value) { | ||
if (value == null) { | ||
return false; | ||
} | ||
if (objToString.call(value) == funcTag) { | ||
return reNative.test(fnToString.call(value)); | ||
} | ||
return (isObjectLike(value) && reHostCtor.test(value)) || false; | ||
} | ||
/** | ||
* 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; |
@@ -1,3 +0,3 @@ | ||
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas, | ||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, | ||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -22,2 +22,2 @@ | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "lodash.isarray", | ||
"version": "2.4.1", | ||
"description": "The Lo-Dash function `_.isArray` as a Node.js module generated by lodash-cli.", | ||
"homepage": "http://lodash.com/custom-builds", | ||
"version": "3.0.0", | ||
"description": "The modern build of lodash’s `_.isArray` as a module.", | ||
"homepage": "https://lodash.com/", | ||
"icon": "https://lodash.com/icon.svg", | ||
"license": "MIT", | ||
"keywords": ["functional", "lodash", "lodash-modularized", "server", "util"], | ||
"keywords": "lodash, lodash-modularized, stdlib, util", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
"Mathias Bynens <mathias@qiwi.be> (http://mathiasbynens.be/)" | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
], | ||
"bugs": "https://github.com/lodash/lodash-cli/issues", | ||
"repository": { "type": "git", "url": "https://github.com/lodash/lodash-cli.git" }, | ||
"dependencies": { | ||
"lodash._isnative": "~2.4.1" | ||
} | ||
"repository": "lodash/lodash", | ||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } | ||
} |
@@ -1,15 +0,20 @@ | ||
# lodash.isarray v2.4.1 | ||
# lodash.isarray v3.0.0 | ||
The [Lo-Dash](http://lodash.com/) function [`_.isArray`](http://lodash.com/docs#isArray) as a [Node.js](http://nodejs.org/) module generated by [lodash-cli](https://npmjs.org/package/lodash-cli). | ||
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. | ||
## Author | ||
## Installation | ||
| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | | ||
|---| | ||
| [John-David Dalton](http://allyoucanleet.com/) | | ||
Using npm: | ||
## Contributors | ||
```bash | ||
$ {sudo -H} npm i -g npm | ||
$ npm i --save lodash.isarray | ||
``` | ||
| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](https://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | | ||
|---|---|---| | ||
| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) | | ||
In Node.js/io.js: | ||
```js | ||
var isArray = require('lodash.isarray'); | ||
``` | ||
See the [documentation](https://lodash.com/docs#isArray) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.isarray) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7214
0
142
21
1
- Removedlodash._isnative@~2.4.1
- Removedlodash._isnative@2.4.1(transitive)