string
string
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const name = sanitize.allspecialsChars('<p>shopopop</p><br>')
assert.equal(name, 'pshopopoppbr')
Escape all bad unicode (https://javascript.info/regexp-unicode)
string
string
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const string = sanitize.escapeBadUnicode('Hello world 🙂!')
assert.equal(string, 'Hello world !')
string
Handle
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const stripSlashesLeft = sanitize.ltrim('/')
const path = stripSlashesLeft('///delivery')
assert.equal(path, 'delivery')
string
string
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
assert.equal(sanitize.quoteString('lorem ipsum'), '"lorem ipsum"')
assert.equal(sanitize.quoteString(['lorem', 99]), 'lorem,99')
replace accent with their corresponding value
string
string
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const address = sanitize.removeAccents('Allée du Moulin 44980 Angoulême')
assert.equal(address, 'Allee du Moulin 44980 Angouleme')
string
Handle
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const stripSlashesRight = sanitize.rtrim('/')
const path = stripSlashesRight('delivery////')
assert.equal(path, 'delivery')
Sanitize all html tags
string
string
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const textarea = sanitize.stripTags('<p>shopopop</p><br>')
assert.equal(textarea, 'shopopop')
string
Handle
import { sanitize } from "@stephen-shopopop/standard"
import assert from 'assert/strict'
const stripSlashes = sanitize.rtrim('/')
const path = stripSlashes('////delivery////')
assert.equal(path, 'delivery')
Generated using TypeDoc
Sanitize all specials characters: /\?¿¡[]=<>:;,._-'"&$#*()|~`!{}