use this command to installation
npm install best-string
import BestString from 'best-string' //or require
import BestString from "best-string";
const my_text = new BestString('Hello <script>alert("TEST")</script>').noScriptTag().build()
console.log(my_text) //Result: 'Hello'
const text = new BestString('Hi چطوری؟').noRtlCharacters().build();
console.log(text) //Result: 'Hi'
const user = 'Jack'
const message = new BestString('welcome {user}! your role is ROLE!,your nickname is {user}')
.replaceGlobal('{user}', user)
.replaceGlobal('ROLE', 'ADMIN')
.build()
console.log(message) //Result: welcome Jack! your role is ADMIN!,your nickname is Jack
- add Methods