normalize-path
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -6,4 +6,10 @@ # {%= name %} {%= badge("fury") %} | ||
## Install | ||
{%= include("install") %} | ||
{%= include("install-npm", {save: true}) %} | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -13,6 +19,13 @@ | ||
var normalize = require('{%= name %}'); | ||
console.log(normalize('\\foo\\bar\\baz\\')); | ||
//=> '//foo/bar/baz' | ||
//=> '/foo/bar/baz' | ||
console.log(normalize('./foo/bar/baz')); | ||
//=> 'foo/bar/baz' | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}). | ||
## Author | ||
@@ -19,0 +32,0 @@ {%= include("author") %} |
15
index.js
/*! | ||
* normalize-path | ||
* https://github.com/jonschlinkert/normalize-path | ||
* normalize-path <https://github.com/jonschlinkert/normalize-path> | ||
* | ||
@@ -11,8 +10,8 @@ * Copyright (c) 2014 Jon Schlinkert, contributors. | ||
var path = require('path'); | ||
module.exports = function(filepath) { | ||
return path.normalize(filepath) | ||
.replace(/\\/g, '/') | ||
.replace(/\/$/g, ''); | ||
}; | ||
return filepath | ||
.replace(/[\\\/]+/g, '/') | ||
.replace(/^\.[\\\/]/g, '') | ||
.replace(/\/$/g, '') | ||
.toLowerCase(); | ||
}; |
{ | ||
"name": "normalize-path", | ||
"description": "Normalize file path slashes to be unix-like forward slashes, regardless of OS (since in reality Windows doesn't care about slash direction anyway). Also condenses repeat slashes to a single slash and removes and trailing slashes.", | ||
"version": "0.1.1", | ||
"description": "Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/normalize-path", | ||
@@ -24,7 +24,11 @@ "author": { | ||
"keywords": [ | ||
"file", | ||
"filepath", | ||
"fp", | ||
"normalize", | ||
"path", | ||
"filepath", | ||
"slash", | ||
"slashes" | ||
"slashes", | ||
"trailing", | ||
"unix" | ||
], | ||
@@ -39,6 +43,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"verb": "~0.2.6", | ||
"chai": "~1.9.1", | ||
"mocha": "*" | ||
"benchmarked": "^0.1.1", | ||
"mocha": "*", | ||
"should": "^4.0.4", | ||
"verb": "^0.2.15" | ||
} | ||
} | ||
} |
@@ -1,12 +0,18 @@ | ||
# normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.png)](http://badge.fury.io/js/normalize-path) | ||
# normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.svg)](http://badge.fury.io/js/normalize-path) | ||
> Normalize file path slashes to be unix-like forward slashes, regardless of OS (since in reality Windows doesn't care about slash direction anyway). Also condenses repeat slashes to a single slash and removes and trailing slashes. | ||
> Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes. | ||
## Install | ||
Install with [npm](npmjs.org): | ||
#### Install with [npm](npmjs.org) | ||
```bash | ||
npm i normalize-path --save-dev | ||
npm i normalize-path --save | ||
``` | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -16,6 +22,13 @@ | ||
var normalize = require('normalize-path'); | ||
console.log(normalize('\\foo\\bar\\baz\\')); | ||
//=> '//foo/bar/baz' | ||
//=> '/foo/bar/baz' | ||
console.log(normalize('./foo/bar/baz')); | ||
//=> 'foo/bar/baz' | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-path/issues). | ||
## Author | ||
@@ -34,2 +47,2 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 25, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 18, 2014._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11381
33
218
46
4
1