Skip to content

trim

Trim values from a string

150 bytes

Usage

Trims all prefix and suffix characters from the given string. Like the builtin trim function but accepts alternate (other than space) characters you would like to trim.

import * as _ from 'radashi'
_.trim(' hello ') // => hello
_.trim('__hello__', '_') // => hello
_.trim('/repos/:owner/', '/') // => repos/:owner

Trim also handles more than one character to trim.

_.trim('222__hello__111', '12_') // => hello