Skip to content

sajjadmrx/best-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Best-string Logo


A package to manipulate string.

Instalation

use this command to installation

npm install best-string

imports

import BestString from 'best-string' //or require

Usage

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

TODO

  • add Methods