text-replacer

1.0.2 • Public • Published

Text-Replace [NPM version]

Node.js transform stream that performs text based search and replacements. Since replaceAll method is not defined in nodeJs so I designed this for some usefull use case.

Installation

npm install text-replacer --save

Usage

Streaming search and replace

Let's say we have the following text:

I am here to say youbrbut you don't want to listen

To replace all occurrences of 'br' with '<br />' we could do this:

const Replacer = require("replace-text");

let replacerConfig = {
"~br~": "<br />",
"~tb~": "<hr />",
};
let replacer = new Replacer(replacerConfig);

replacer.replace("I am here to say you~br~but you don't want to listen");  //I am here to say you<br />but you don't want to listen

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i text-replacer

    Weekly Downloads

    3

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    2.2 kB

    Total Files

    3

    Last publish

    Collaborators

    • dan89farhan