@contrast/patcher
Advanced tools
Comparing version 1.7.3 to 1.7.4
@@ -242,3 +242,3 @@ /* | ||
* | ||
* @param {Object} obj the function or the object that contains the property/method we want to hook | ||
* @param {Object} obj the object that contains the property/method we want to hook | ||
* @param {string} prop the property/method of the object that we want to hook | ||
@@ -249,7 +249,2 @@ * @param {Object} opts options for hooking | ||
function hook(obj, prop, opts) { | ||
// indicates object is a function and not an object with methods | ||
if (!prop) { | ||
return hookFunction(obj, opts); | ||
} | ||
const desc = getDescriptor(obj, prop); | ||
@@ -350,3 +345,4 @@ if (desc.writable || desc.set) { | ||
const fn = hook(obj, prop, options); | ||
// if no property, hook a function directly. | ||
const fn = prop ? hook(obj, prop, options) : hookFunction(obj, options); | ||
const fnHooks = hooks.get(fn) || { | ||
@@ -353,0 +349,0 @@ pre: new Map(), |
{ | ||
"name": "@contrast/patcher", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Advanced monkey patching--registers hooks to run in and around functions", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
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
19795
470