trim-strings
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

trim-strings

This package is simply a standalone version of lodash's trim functions. Credit goes to them for the implementation.

Usage

Usage is simple:

const { trim, trimStart, trimEnd } = require("trim-strings");
 
console.log(trim(" abc ")); // outputs "abc"
console.log(trimStart(" abc ")); // outputs "abc "
console.log(trimEnd(" abc ")); // outputs " abc"
 
console.log(trim("-a b c-", "-")); // outputs "a b c"
console.log(trimStart("-_-abc_-_", "-_")); // outputs "abc_-_"
console.log(trimEnd("--abc__", "--")); // outputs "--abc__"

Tests

To run the test suite, run yarn run test in the root of this repository.

/trim-strings/

    Package Sidebar

    Install

    npm i trim-strings

    Weekly Downloads

    3

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    19.5 kB

    Total Files

    37

    Last publish

    Collaborators

    • djmattyg007