包详细信息

rtrim

sergejmueller22.5kMIT不推荐使用1.0.1

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

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

trim, rtrim, strip, string

自述文件

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])
Parameter Description
str The input string
chars Characters 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

更新日志

rtrim / CHANGELOG

v1.0.1 (2020-11-25)

  • Cleanup code
  • Update Node.js versions at .travis.yml

v1.0.0 (2016-10-28)

  • Add ESLint with node plugin
  • Remove *.lock from .gitignore
  • Refactor package.json
  • Text changes in README.md
  • Add yarn.lock file
  • Some code cleanups

v0.0.3 (2016-06-17)

  • Cleanup readme

v0.0.2 (2016-06-17)

  • Adjust code to ltrim

v0.0.1 (2016-06-16)

  • Initial commit