ljharb/js-traverse
GitHub で見るDoes not work with builtin objects with internal slots (URL, Map, Set, etc)
Open
#10 opened on 2024年5月29日
bughelp wanted
Repository metrics
- Stars
- (61 stars)
- PR merge metrics
- (PR metrics pending)
説明
For instance:
traverse({ url: new URL("https://example.com") }).map(function () {
if (this.node instanceof URL) {
this.update(this.node.toString());
}
});
TypeError: Receiver must be an instance of class URL
❯ Object.<anonymous> src/log-sanitizer.spec.ts:57:31
55| traverse({ url: new URL("https://example.com") }).map(function () {
56| if (this.node instanceof URL) {
57| this.update(this.node.toString());
| ^
58| }
59| });
❯ walker node_modules/traverse/index.js:169:16
❯ node_modules/traverse/index.js:190:17
❯ forEach node_modules/traverse/index.js:19:30
❯ walker node_modules/traverse/index.js:185:4
❯ walk node_modules/traverse/index.js:208:3
❯ Traverse.map node_modules/traverse/index.js:251:9