Last active
May 4, 2017 22:58
-
-
Save ccummings/38edd2809ce6e063a2a1be4d8fd0d459 to your computer and use it in GitHub Desktop.
Who's the boss?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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