Nice Philanthropist Metalhead
Have ideas to improve npm?Join in the discussion! »

strip-trailing-slashes

0.1.0 • Public • Published

Strip Trailing Slashes

A function that removes all slashes from the end of a string.

This function:

  • makes no assumptions about the kind of slash (forward / or backward \)
  • does not care what the current operating system or file system is
  • does not care what the operating system or file system was for the string's source
  • does not distinguish between file system path, a URL, or any other kind of string

If there is one or more slashes at the end of a string, they get removed.

That is all there is to it.

API

stripTrailingSlashes(text)

text

Type: String

The string of text you want to remove trailing slashes from. If this is not a string, it will throw a TypeError.

Install

npm i strip-trailing-slashes

DownloadsWeekly Downloads

3

Version

0.1.0

License

BSD-3-Clause

Last publish

Collaborators

  • avatar