An extension to String Methods, to add some features to ECMAScript 6. It works bothe for Node and the browser.
npm install string-methods-extensionVia npm:
``bash`
npm install string-methods-extension
In a browser:
`html`
In Node.js:
`js`
require('string-methods-extension');
Using yarn
yarn add string-methods-extension
The stripLineBreak() method removes all line breaks from a string.
`javascripttest\ntest\ntest..stripLineBreak();test test test.
// =>
test \ntest \ntest..stripLineBreak('');test test test.
// =>
test\ntest\ntest..stripLineBreak('.');test.test.test.
// => `
The trim() method removes whitespace or a specified character from both sides of a string.
`javascript ahsdfjhfhf .trim();ahsdfjhfhf
// =>
......ahsdfjhfhf......trim('.');ahsdfjhfhf
// => `
The trimStart() method removes whitespace or a specified character at the left side of a string.
`javascript ahsdfjhfhf .trimStart();ahsdfjhfhf
// =>
......ahsdfjhfhf......trimStart('.');ahsdfjhfhf.....
// => `
The trimEnd() method removes whitespace or a specified character at the right side of a string.
`javascript ahsdfjhfhf .trimEnd(); ahsdfjhfhf
// =>
......ahsdfjhfhf......trimEnd('.');......ahsdfjhfhf
// => `
The reverse() method reverse the characters of a string.
`javascriptabcdef.reverse();fedcba
// =>
Hello World.reverse();dlroW olleH
// => `
The stripTags() method removes html or xml tags from a string.
`javascriptHello world!.stripTags();Hello world!
// =>
Hello world!.stripTags();Hello world!
// => `
The stripWhiteSpace() method removes white spaces from a string, with a single space or specified character.
`javascripttest test test.stripWhiteSpace();test test test
// =>
test test test.stripWhiteSpace('.');test.test.test
// => `
The replaceAll() method returns a string where a specified string is replaced with another specified string.
`javascript123 test nl..replaceAll({'123': 'abc','nl': 'Netherlands',});abc test Netherlands.
// =>
You should eat fruits, vegetables, and fiber every day.replaceAll({'fruits': 'pizza','vegetables': 'beer', 'fiber': 'ice cream',});You should eat pizza, beer, and ice cream every day
// => `
The encodeXML() method adds XML encoding to a string.
`javascripttest&"test" 1<2.encodeXML();test&"testquot; 1<2
// => `
The decodeXML() method removes XML encoding form a string.
`javascripttest&"testquot; 1<2.decodeXML();test&"test" 1<2
// => `
After cloning this repository, run npm install--dev to install the dependencies needed for he development and testing.npm test`
Once that is done, you can run the unit tests in Node using