Skip to content
jscodeshift script to convert import 'lodash.get' to import 'lodash/get' etc.
JavaScript
Branch: master
Clone or download

README.md

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.
You can’t perform that action at this time.