Skip to content

jscodeshift script to convert import 'lodash.get' to import 'lodash/get' etc.

License

Notifications You must be signed in to change notification settings

jcoreio/jscodeshift-replace-lodash-method-packages

Repository files navigation

jscodeshift-replace-lodash-method-packages

Build Status Coverage Status semantic-release Commitizen friendly

This is a codemod script for use with JSCodeshift that helps convert lodash method package imports/requires (e.g. lodash.mapvalues) to imports from lodash submodules (e.g. lodash/mapValues)

Setup & Run

  1. yarn global add jscodeshift
  2. git clone https://github.com/jcoreio/jscodeshift-replace-lodash-method-packages.git
  3. Run yarn install in the cloned directory
  4. jscodeshift -t <path/to>/jscodeshift-replace-lodash-method-packages/index.js <path>
    • path - files or directory to transform;
    • use the -d option for a dry-run and use -p to print the output for comparison;
    • use the --extensions option if your files have different extensions than .js (for example, --extensions js,jsx);
    • if you use flowtype, you might also need to use --parser=flow or --parser=babylon;
    • see all available jscodeshift options.

About

jscodeshift script to convert import 'lodash.get' to import 'lodash/get' etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published