Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash.isnative

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.isnative - npm Package Compare versions

Comparing version 3.0.7 to 4.0.0

93

index.js
/**
* lodash 3.0.7 (Custom Build) <https://lodash.com/>
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`

@@ -23,2 +23,11 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/>

/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/**

@@ -46,2 +55,11 @@ * Checks if `value` is a host object in IE < 9.

/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */

@@ -67,2 +85,38 @@ var funcToString = Function.prototype.toString;

/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `func` is capable of being masked.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
*/
var isMaskable = coreJsData ? isFunction : stubFalse;
/**
* Converts `func` to its source code.

@@ -94,4 +148,3 @@ *

* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example

@@ -144,4 +197,12 @@ *

/**
* Checks if `value` is a native function.
* Checks if `value` is a pristine native function.
*
* **Note:** This method can't reliably detect native functions in the presence
* of the core-js package because core-js circumvents this kind of detection.
* Despite multiple requests, the core-js maintainer has made it clear: any
* attempt to fix the detection will be obstructed. As a result, we're left
* with little choice but to throw an error. Unfortunately, this also affects
* packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
* which rely on core-js.
*
* @static

@@ -163,9 +224,25 @@ * @memberOf _

function isNative(value) {
if (!isObject(value)) {
return false;
if (isMaskable(value)) {
throw new Error('This method is not supported with core-js. Try https://github.com/es-shims.');
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
return baseIsNative(value);
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = isNative;

2

package.json
{
"name": "lodash.isnative",
"version": "3.0.7",
"version": "4.0.0",
"description": "The lodash method `_.isNative` exported as a module.",

@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/",

@@ -1,2 +0,2 @@

# lodash.isnative v3.0.7
# lodash.isnative v4.0.0

@@ -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.7-npm-packages/lodash.isnative) for more details.
See the [documentation](https://lodash.com/docs#isNative) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.isnative) for more details.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc