Comparing version 0.5.6 to 0.5.7
37
index.js
@@ -28,2 +28,11 @@ 'use strict'; | ||
function setPrototypeOf(obj, proto) { | ||
if (Object.setPrototypeOf) { | ||
return Object.setPrototypeOf(obj, proto); | ||
} else { | ||
obj.__proto__ = proto; | ||
return obj; | ||
} | ||
} | ||
// hook stuff | ||
@@ -64,2 +73,21 @@ (function () { | ||
function copyProperties(source, target) { | ||
// this should inherit 'name' and 'length' and any other properties that have been assigned | ||
Object.getOwnPropertyNames(source).forEach(function (key) { | ||
try { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
} catch (e) { | ||
// some properties cannot be redefined, not much we can do about it | ||
} | ||
}); | ||
if (!Object.getOwnPropertySymbols) { return; } | ||
Object.getOwnPropertySymbols(source).forEach(function (sym) { | ||
try { | ||
Object.defineProperty(target, sym, Object.getOwnPropertyDescriptor(source, sym)); | ||
} catch (e) { | ||
// some properties cannot be redefined, not much we can do about it | ||
} | ||
}); | ||
} | ||
// wraps a function with a proxy function holding the first userland call | ||
@@ -89,9 +117,3 @@ // site in the stack and some other information, for later display | ||
// this should inherit 'name' and 'length' and any other properties that have been assigned | ||
Object.getOwnPropertyNames(fn).forEach(function (key) { | ||
try { | ||
Object.defineProperty(wrapped, key, Object.getOwnPropertyDescriptor(fn, key)); | ||
} catch (e) { | ||
// some properties cannot be redefined, not much we can do about it | ||
} | ||
}); | ||
copyProperties(fn, wrapped); | ||
@@ -145,2 +167,3 @@ // we use these later to identify the source information about an open handle | ||
}; | ||
copyProperties(GLOBALS[type], global[type]); | ||
}; | ||
@@ -147,0 +170,0 @@ wrapTimer('setTimeout', false); |
{ | ||
"name": "wtfnode", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "Utility to help find out why Node isn't exiting", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
32580
11
669