Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fabioricali/super-trailing-slash

Add or remove trailing slash
https://github.com/fabioricali/super-trailing-slash

backslash javascript path trailing-slash url

Last synced: 16 days ago
JSON representation

Add or remove trailing slash

Awesome Lists containing this project

README

        


super-trailing-slash


Remove or add trailing slash.







## Installation

### Node.js
```
npm install super-trailing-slash --save
```

## Example

#### Add trailing slash
```javascript
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
```javascript
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