项目作者: fabioricali

项目描述 :
Add or remove trailing slash
高级语言: JavaScript
项目地址: git://github.com/fabioricali/super-trailing-slash.git
创建时间: 2017-08-27T10:42:47Z
项目社区:https://github.com/fabioricali/super-trailing-slash

开源协议:MIT License

下载



super-trailing-slash


Remove or add trailing slash.







Installation

Node.js

  1. npm install super-trailing-slash --save

Example

Add trailing slash

  1. const slash = require('super-trailing-slash');
  2. slash.add('path/to/file'); //=> path/to/file/
  3. slash.add('\\path\\to\\file'); //=> \path\to\file\
  4. // Adds only if necessary
  5. slash.add('path/to/file/'); //=> path/to/file/

Remove trailing slash

  1. slash.remove('path/to/file/'); //=> path/to/file
  2. slash.remove('\\path\\to\\file\\'); //=> \path\to\file
  3. // Removes only if necessary
  4. 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