mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Currently the codemod always runs `root.toSource()`, recreating the source from the AST. But this can sometimes add unexpected semicolons to files that actually didn't get updated by the codemod. This PR adds a check to see if the AST has been updated before running `root.toSource()`, otherwise it just returns the original source.
5 lines
126 B
TypeScript
5 lines
126 B
TypeScript
export const unaffected = (string) => {
|
|
return string
|
|
.replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2')
|
|
.toLowerCase()
|
|
} |