🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

clone-function

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clone-function - npm Package Compare versions

Comparing version

to
1.0.5

2

package.json
{
"name": "clone-function",
"version": "1.0.4",
"version": "1.0.5",
"description": "Clones non native JavaScript functions, or references native functions.",

@@ -5,0 +5,0 @@ "main": "./src/clone-function.js",

@@ -17,7 +17,12 @@ /*

function cloneFunction(func) {
var out;
if (/\[native code\]/.test(func.toString())) {
out = func;
} else {
out = eval('(function(){return ' + func.toString() + '}());');
var out, str;
try {
str = func.toString();
if (/\[native code\]/.test(str)) {
out = func;
} else {
out = eval('(function(){return ' + str + '}());');
}
} catch (e) {
throw new Error(e.message + '\r\n\r\n' + str);
}

@@ -24,0 +29,0 @@ return out;