JSPM

remove-trailing-separator

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14330833
  • Score
    100M100P100Q240558F
  • License ISC

Removes separators from the end of the string.

Package Exports

  • remove-trailing-separator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remove-trailing-separator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remove-trailing-separator

NPM version Build Status Coveralls Status

Removes all separators from the end of a string.

Install

npm install remove-trailing-separator

Examples

const removeTrailingSeparator = require('remove-trailing-separator');

removeTrailingSeparator('/foo/bar/')   // '/foo/bar'
removeTrailingSeparator('/foo/bar///') // '/foo/bar'

// leaves only/last separator
removeTrailingSeparator('/')    // '/'
removeTrailingSeparator('///')  // '/'

// returns empty string
removeTrailingSeparator('') // ''

// same as above for win32 separators
removeTrailingSeparator('\\foo\\bar\\')     // '\\foo\\bar'
removeTrailingSeparator('\\foo\\bar\\\\\\') // '\\foo\\bar'
removeTrailingSeparator('\\')               // '\\'
removeTrailingSeparator('\\\\\\')           // '\\'
removeTrailingSeparator('')                 // ''