facebook / facebook/jscodeshift
Path containing an array VS array of paths
Aperta
question
- Lingua principale
- JavaScript
- Stelle
- 10k
- Fork
- 498
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Is there a more idiomatic way of doing this? The `map(p => p)` part (which I've found in #46) is counterintuitive. My proposal is to call it automatically inside `Collection#map` when it gets a path containing an array.
```ts
const topLevelThingies = ast.map(path =>
path.get('program')
.get('body') // Doesn't return an array, it returns a NodePath that contains an array.
.map(p => p) // Converting to an array of paths. ¯\_(ツ)_/¯
);
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.