1.1.0 • Published 3 years ago

replace-in-path v1.1.0

Weekly downloads
46
License
MIT
Repository
github
Last release
3 years ago

Build npm.io npm.io code style: prettier PRs Welcome

Install

npm install replace-in-path --save-dev

Or if you prefer yarn:

yarn add replace-in-path --dev

Quick Example:

const codeReplacements = [
    {
        find: `const { security } = this.context;`,
        replaceWith: `// const { security } = this.context;`,
    },
    {
        find: "const identity = await security.getIdentity",
        replaceWith: "// const identity = await security.getIdentity",
    },
    {
        find: new RegExp("createdBy: identity.*},", "gms"),
        replaceWith: "/* $& */",
    },
];

replaceInPath(
    path.join(newCodePath, "/resolvers/TargetDataModelsMutation.ts"),
    codeReplacements
);