JSPM

super-trailing-slash

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q70284F
  • License MIT

Add or remove trailing slash

Package Exports

  • super-trailing-slash

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 (super-trailing-slash) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

super-trailing-slash

Remove or add trailing slash.

Installation

Node.js

npm install super-trailing-slash --save

Example

Add trailing slash

const slash = require('super-trailing-slash');

slash.add('path/to/file'); //=> path/to/file/
slash.add('\\path\\to\\file'); //=> \path\to\file\

// Adds only if necessary
slash.add('path/to/file/'); //=> path/to/file/

Remove trailing slash

slash.remove('path/to/file/'); //=> path/to/file
slash.remove('\\path\\to\\file\\'); //=> \path\to\file

// Removes only if necessary
slash.remove('path/to/file'); //=> path/to/file

API

See full documentation

Changelog

You can view the changelog here

License

super-trailing-slash is open-sourced software licensed under the MIT license

Author

Fabio Ricali