Skip to content

Instantly share code, notes, and snippets.

View chintan9's full-sized avatar

Chintan Prajapati chintan9

View GitHub Profile
@chintan9
chintan9 / lodash-imports-codemod.js
Created October 13, 2021 05:03 — forked from laurenashpole/lodash-imports-codemod.js
A jscodeshift codemod for converting any Lodash imports into direct imports
export default (fileInfo, api) => {
const j = api.jscodeshift;
const root = j(fileInfo.source);
let specifiers = [];
root
.find(j.ImportDeclaration, isLodashImport)
.forEach((path) => specifiers.push(...path.node.specifiers.map((specifier) => specifier.local.name)))
.remove();