Skip to content

Standalone version of lodash string trim functions

License

Notifications You must be signed in to change notification settings

djmattyg007/js-trim-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Standalone version of lodash string trim functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published