lodash.isnative
Advanced tools
Comparing version 3.0.6 to 3.0.7
91
index.js
/** | ||
* lodash 3.0.6 (Custom Build) <https://lodash.com/> | ||
* lodash 3.0.7 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
@@ -14,6 +14,9 @@ | ||
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ | ||
/** | ||
* Used to match `RegExp` | ||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). | ||
*/ | ||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; | ||
/** Used to detect host constructors (Safari > 5). */ | ||
/** Used to detect host constructors (Safari). */ | ||
var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
@@ -50,3 +53,4 @@ | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -63,2 +67,21 @@ */ | ||
/** | ||
* Converts `func` to its source code. | ||
* | ||
* @private | ||
* @param {Function} func The function to process. | ||
* @returns {string} Returns the source code. | ||
*/ | ||
function toSource(func) { | ||
if (func != null) { | ||
try { | ||
return funcToString.call(func); | ||
} catch (e) {} | ||
try { | ||
return (func + ''); | ||
} catch (e) {} | ||
} | ||
return ''; | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
@@ -68,5 +91,7 @@ * | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
@@ -82,4 +107,4 @@ * | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in Safari 8 which returns 'object' for typed array constructors, and | ||
// PhantomJS 1.9 which returns 'function' for `NodeList` instances. | ||
// in Safari 8 which returns 'object' for typed array and weak map constructors, | ||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances. | ||
var tag = isObject(value) ? objectToString.call(value) : ''; | ||
@@ -90,7 +115,9 @@ return tag == funcTag || tag == genTag; | ||
/** | ||
* 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('')`) | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
@@ -119,29 +146,2 @@ * @param {*} value The value to check. | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
} | ||
/** | ||
* Checks if `value` is a native function. | ||
@@ -151,5 +151,7 @@ * | ||
* @memberOf _ | ||
* @since 3.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a native function, else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a native function, | ||
* else `false`. | ||
* @example | ||
@@ -164,12 +166,9 @@ * | ||
function isNative(value) { | ||
if (value == null) { | ||
if (!isObject(value)) { | ||
return false; | ||
} | ||
if (isFunction(value)) { | ||
return reIsNative.test(funcToString.call(value)); | ||
} | ||
return isObjectLike(value) && | ||
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value); | ||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; | ||
return pattern.test(toSource(value)); | ||
} | ||
module.exports = isNative; |
{ | ||
"name": "lodash.isnative", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "The lodash method `_.isNative` exported as a module.", | ||
@@ -12,3 +12,3 @@ "homepage": "https://lodash.com/", | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -15,0 +15,0 @@ ], |
@@ -1,2 +0,2 @@ | ||
# lodash.isnative v3.0.6 | ||
# lodash.isnative v3.0.7 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.isNative` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#isNative) or [package source](https://github.com/lodash/lodash/blob/3.0.6-npm-packages/lodash.isnative) for more details. | ||
See the [documentation](https://lodash.com/docs#isNative) or [package source](https://github.com/lodash/lodash/blob/3.0.7-npm-packages/lodash.isnative) for more details. |
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
7513
1
151