@domql/utils
Advanced tools
Comparing version 2.5.119 to 2.5.123
@@ -21,2 +21,3 @@ "use strict"; | ||
__export(function_exports, { | ||
cloneFunction: () => cloneFunction, | ||
debounce: () => debounce, | ||
@@ -71,1 +72,12 @@ debounceOnContext: () => debounceOnContext, | ||
}; | ||
function cloneFunction(fn, win = window) { | ||
const temp = function() { | ||
return fn.apply(win, arguments); | ||
}; | ||
for (const key in fn) { | ||
if (Object.hasOwnProperty.call(fn, key)) { | ||
temp[key] = fn[key]; | ||
} | ||
} | ||
return temp; | ||
} |
@@ -64,2 +64,3 @@ "use strict"; | ||
var import_node = require("./node.js"); | ||
var import_function = require("./function.js"); | ||
const exec = (param, element, state, context) => { | ||
@@ -176,2 +177,4 @@ if ((0, import_types.isFunction)(param)) { | ||
o[prop] = deepCloneWithExtend(objProp, excludeFrom, options); | ||
} else if ((0, import_types.isFunction)(objProp) && options.window) { | ||
o[prop] = (0, import_function.cloneFunction)(objProp, options.window); | ||
} else | ||
@@ -178,0 +181,0 @@ o[prop] = objProp; |
@@ -74,1 +74,15 @@ 'use strict' | ||
} | ||
export function cloneFunction (fn, win = window) { | ||
const temp = function () { | ||
return fn.apply(win, arguments) | ||
} | ||
// Copy properties from original function | ||
for (const key in fn) { | ||
if (Object.hasOwnProperty.call(fn, key)) { | ||
temp[key] = fn[key] | ||
} | ||
} | ||
return temp | ||
} |
@@ -8,2 +8,3 @@ 'use strict' | ||
import { isDOMNode } from './node.js' | ||
import { cloneFunction } from './function.js' | ||
@@ -180,2 +181,4 @@ export const exec = (param, element, state, context) => { | ||
// }) | ||
} else if (isFunction(objProp) && options.window) { | ||
o[prop] = cloneFunction(objProp, options.window) | ||
} else o[prop] = objProp | ||
@@ -182,0 +185,0 @@ } |
{ | ||
"name": "@domql/utils", | ||
"version": "2.5.119", | ||
"version": "2.5.123", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "type": "module", | ||
}, | ||
"gitHead": "930d02cd05b1fa9cbfe3da9b1eea3f1baafdab6b", | ||
"gitHead": "6dd041deb89bc2ebfa1f5ee9360d563df60eca13", | ||
"devDependencies": { | ||
@@ -29,0 +29,0 @@ "@babel/core": "^7.12.0" |
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
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
90416
2729