Skip to content

Instantly share code, notes, and snippets.

@ccummings
Last active May 4, 2017 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccummings/38edd2809ce6e063a2a1be4d8fd0d459 to your computer and use it in GitHub Desktop.
Save ccummings/38edd2809ce6e063a2a1be4d8fd0d459 to your computer and use it in GitHub Desktop.
Who's the boss?
module.exports = function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.Literal)
.forEach(path => {
var raw = path.node.raw.toLowerCase()
if (raw === '"justin"' || raw === "'justin'") {
j(path).replaceWith(
j.literal("Boss")
);
}
})
.toSource();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment