You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

rtrim

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtrim

Strip whitespace - or other characters - from the end of a string

1.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

rtrim

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

Build Status Code Climate Known Vulnerabilities

Install

npm install rtrim

or

yarn add rtrim

Usage

rtrim(str[, chars])
ParameterDescription
strThe input string
charsCharacters that you want to be stripped

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

Examples

var rtrim = require('rtrim');

/* Strip whitespace from the end of a string */
rtrim('    Hello    ') + ' World' // →    Hello World

/* Strip multiple special chars from the end of a string */
rtrim('... Hello World ...', ' .'); // →... Hello World

/* Strip multiple chars from the end of a string */
rtrim('Hello World', 'Hdle'); // →Hello Wor

/* Strip trailing slash from the end of a string */
rtrim('https://goo.gl/', '/'); // →https://goo.gl

Keywords

trim

FAQs

Package last updated on 25 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts