Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dgrijuela/modular-lodash-codemod


https://github.com/dgrijuela/modular-lodash-codemod

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

        

This script makes all your lodash imports modular.

For example:

```
import { sortBy } from 'lodash'
import { throttle, debounce } from 'lodash'
```

Would be:

```
import sortBy from 'lodash/sortBy'
import throttle from 'lodash/throttle'
import debounce from 'lodash/debounce'
```

Setup & Run

```
npm install -g jscodeshift
git clone https://github.com/dgrijuela/modular-lodash-codemod.git
jscodeshift -t modular-lodash-codemod/modular-lodash.js
```

Check both JS and JSX files using the `--extensions` flag:

```
jscodeshift --extensions=js,jsx -t modular-lodash-codemod/modular-lodash.js
```