1.1.2 • Published 6 years ago

drivetribe-string-formatters v1.1.2

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

drivetribe-string-formatters

Collection of string formatter functions to change strings.

Install

Install the module directly from npm:

npm install drivetribe-string-formatters --save

Formatters

Abbreviate

Abbreviate by initials of first three words found in string, ie "Lorem ipsum dolor sit amet" -> "Lid".

abbreviate(quant: string): string

Example

import { abbreviate } from 'drivetribe-string-formatters';

abbreviate("Lorem ipsum dolor sit amet"); // "Lid"
abbreviate("Lorem ipsum"); // "Li"

Remove non alphanumeric

Remove non alphanumeric chararacters in string, ie '\/-12 3asd./,\][-=+_!@£$%^&*(±)?><~' -> "123asd".

removeNonAlphaNumeric(quant: string): string

Example

import { removeNonAlphaNumeric } from 'drivetribe-string-formatterss';

removeNonAlphaNumeric("-123asd "); // "123asd"