Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • allspecialsChars(value: string): string
  • Sanitize all specials characters: /\?¿¡[]=<>:;,._-'"&$#*()|~`!{}

    Parameters

    • value: string

      string

    Returns 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')
  • escapeBadUnicode(value: string): string
  • Escape all bad unicode (https://javascript.info/regexp-unicode)

    Parameters

    • value: string

      string

    Returns string

    string

    import { sanitize } from "@stephen-shopopop/standard"
    import assert from 'assert/strict'

    const string = sanitize.escapeBadUnicode('Hello world 🙂!')

    assert.equal(string, 'Hello world !')
  • ltrim(char?: string): Handle<string>
  • Parameters

    • Optional char: string

      string

    Returns Handle<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')
  • quoteString(value: unknown): string
  • Parameters

    • value: unknown

      string

    Returns 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')
  • removeAccents(value: string): string
  • replace accent with their corresponding value

    Parameters

    • value: string

      string

    Returns 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')
  • rtrim(char?: string): Handle<string>
  • Parameters

    • Optional char: string

      string

    Returns Handle<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')
  • stripTags(value: string): string
  • Sanitize all html tags

    Parameters

    • value: string

      string

    Returns 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')
  • trim(char?: string): Handle<string>
  • Parameters

    • Optional char: string

      string

    Returns Handle<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