slasher
Prefix a path with leading slash
Last updated 12 years ago by scottcorgan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install slasher 
SYNC missed versions from official npm registry.

slasher

Prefix a path with leading slash

Install

npm install slasher --save

Usage

var slash = require('slasher');

// Strings
var pathname = 'some/path/to/something';
var pathname = slash(pathname); // OUTPUTS: '/some/path/to/something'

// Objects
var paths = {
  'some/route': 'index.html'
};
var paths = slash(paths);

// OUTPUTS:
{
  '/some/route': '/index.html'
}

slash(data[, options])

  • data - a string or object to slash
  • options - OPTIONAL. Set key or value to false to not add a slash to those values in an object

Run Tests

npm install
npm test

Current Tags

  • 1.1.0                                ...           latest (12 years ago)

8 Versions

  • 1.1.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.5                                ...           13 years ago
  • 0.1.4                                ...           13 years ago
  • 0.1.3                                ...           13 years ago
  • 0.1.2                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
  • 0.1.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 21
Today 1
This Week 7
This Month 21
Last Day 1
Last Week 14
Last Month 0
Dependencies (1)
Dev Dependencies (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE