This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function objectReduce(obj, cb, acc) { | |
| let idx = 0; | |
| for (let key in obj) { | |
| acc = cb(acc, { key, value : obj[key] }, idx++); | |
| } | |
| return acc; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function findValue(collection, predicate) { | |
| let value; | |
| collection.some(c => { | |
| const p = predicate(c) | |
| if (p) { | |
| value = p; | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage: | |
| // const timer = new Timer("timerName"); | |
| // doThing(); | |
| // timer.measure("didThing"); | |
| // await doThing2(); | |
| // timer.measure("didThing2"); | |
| // timer.report(); | |
| // ┌─────────┬─────────────┬───────────────┬──────────┬───────────┐ | |
| // │ (index) │ name │ time │ duration │ sincePrev │ | |
| // ├─────────┼─────────────┼───────────────┼──────────┼───────────┤ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ ...document.querySelectorAll("tbody tr") ] | |
| .filter(tr => tr.querySelector("td[data-text]")?.attributes["data-text"].value.includes("404")) | |
| .map(tr => { | |
| const td = tr.querySelector("[data-text]"); | |
| const ts = tr.querySelector("td:nth-child(2)"); | |
| const { value } = td.attributes["data-text"]; | |
| const url = value.match(/url: (.*?)[;}]/)[1]; | |
| const referer = value.match(/referer: (.*?)[;}]/); |
OlderNewer