ltrim

1.0.1 • Public • Published

ltrim

ltrim Node.js module returns a string with whitespace (or other characters) stripped from the beginning of a string. Without dependencies and library bloat.

Build Status Code Climate Known Vulnerabilities

Install

npm install ltrim

or

yarn add ltrim

Usage

ltrim (str[, chars])
Parameter Description
str The input string
chars Characters that you want to be stripped

Without the second parameter, ltrim will strip whitespaces (spaces, tabs and new lines).

Examples

var ltrim = require('ltrim');
 
/* Strip whitespace from the beginning of a string */
ltrim('    Hello    ') + ' World' // →Hello     World
 
/* Strip multiple special chars from the beginning of a string */
ltrim('... Hello World ...', ' .'); // →Hello World ...
 
/* Strip multiple chars from the beginning of a string */
ltrim('Hello World', 'Hdle'); // →o World
 
/* Strip url protocol from the beginning of a string */
ltrim('https://goo.gl/', '/:htps'); // →goo.gl/

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i ltrim

    Weekly Downloads

    669

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.59 kB

    Total Files

    5

    Last publish

    Collaborators

    • npm