ljharb/js-traverse

Does not work with builtin objects with internal slots (URL, Map, Set, etc)

Open

#10 ouverte le 29 mai 2024

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)JavaScript (10 forks)github user discovery
bughelp wanted

Métriques du dépôt

Stars
 (61 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

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

Guide contributeur