ljharb/js-traverse

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

Open

#10 aperta il 29 mag 2024

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (10 fork)github user discovery
bughelp wanted

Metriche repository

Star
 (61 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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

Guida contributor