1.0.1 • Published 8 years ago
multi-replacer v1.0.1
multi-replacer
Simple Javascript String Replace Helper
##Introduction A simple helper created to allow replacing strings with multiple search values.
##Usage
The multiReplace
function accepts three arguments namely:
origStr
- the raw string (e.g. <p>This is an awesome test case.</p>
, 'Hello World')
searchStrArr
- array of characters to be replaced. (e.g. <p>
, </p>
)
rplcStr
- the character/string replacement (e.g. '', 'A' or any other string)
##Example
var replace = require('multi-replacer'); <br>
var multiReplace = replacer.multiReplace; <br><br>
var origStr = '<p>Anyone here wants to code?</p>';
var searchStrArr = ['<p>', '</p>'];
var outStr = multiReplace(origStr, searchStrArr, "") //replace <p> & </p> with empty character;
console.log(outStr); //Anyone here wants to code?
##Test
npm test
##Note This is still a WIP, will use ES6 in the future.