-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
err in nodejs http.reques
const http = require("http");
const treeify = require('treeify');
let r = http.request({
hostname: 'ya.ru'
}, (_r) => {
let str = treeify.asTree(_r);
console.log(str);
});
r.on('error', console.error);
r.write('');
r.end();
https://github.com/notatestuser/treeify/blob/master/treeify.js#L32
let count = ((count = 0, timer = null) => () => {
count++;
clearTimeout(timer)
timer = setTimeout(() => {
console.log(`"if (!obj.hasOwnProperty)" counted:${count}`)
}, 1e3);
})()
function filterKeys(obj, hideFunctions) {
var keys = [];
for (var branch in obj) {
// always exclude anything in the object's prototype
if (!obj.hasOwnProperty) count()
if (!obj.hasOwnProperty || !obj.hasOwnProperty(branch)) {
continue;
}
// ... and hide any keys mapped to functions if we've been told to
if (hideFunctions && ((typeof obj[branch]) === "function")) {
continue;
}
keys.push(branch);
}
return keys;
}
result:
"if (!obj.hasOwnProperty)" counted:71
Metadata
Metadata
Assignees
Labels
No labels