UNPKG

jscodeshaft

Version:

Collection of more or less primitive helpers and abstractions for JSCodeShift, build for design system migrations and upgrades.

13 lines (9 loc) 316 B
import {renameElement} from '../renameElement'; export const renameAllElements = (j, root) => (oldName, newName) => { const elements = root.find(j.JSXElement, { openingElement: {name: {name: oldName}}}) if(elements.length){ elements.forEach(({node}) => { renameElement(node)(newName); }) } };