facebook / facebook/jscodeshift
Path containing an array VS array of paths
Open
question
- Dominant language
- JavaScript
- Stars
- 10k
- Forks
- 498
- PR merge metrics
- No merged PRs in 30d
Description
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. ¯\_(ツ)_/¯
);
```
Contributor guide
Assessment
This issue has not been assessed yet.