1.0.0 • Published 2 years ago

jscodeshift-transformcommon v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Use jscodeshift inside of js, without extra fs activity.

const j = require("jscodeshift-transformcommon").api;
const fs = require("fs");

const code = fs.readFileSync("./hello.js", "utf-8");

const e = j(code).find(j.Literal).filter(p => typeof p.node.value == "string").forEach(p => {
    j(p).replaceWith(
        j.literal(p.node.value + ", world!")
    )
})
1.0.0

2 years ago