normalize-path
Advanced tools
Comparing version 0.3.0 to 1.0.0
18
index.js
/*! | ||
* normalize-path <https://github.com/jonschlinkert/normalize-path> | ||
* | ||
* Copyright (c) 2014 Jon Schlinkert, contributors. | ||
* Copyright (c) 2014-2015, Jon Schlinkert. | ||
* Licensed under the MIT License | ||
*/ | ||
'use strict'; | ||
module.exports = function(filepath, stripTrailing) { | ||
filepath = filepath | ||
.replace(/[\\\/]+/g, '/') | ||
.toLowerCase(); | ||
module.exports = function(fp, stripTrailing) { | ||
fp = fp.replace(/[\\\/]+/g, '/'); | ||
if (stripTrailing === false) { | ||
return filepath; | ||
return fp; | ||
} | ||
return filepath.replace(/\/$/g, ''); | ||
return fp.slice(-1) === '/' | ||
? fp.slice(0, fp.length -1) | ||
: fp; | ||
}; |
{ | ||
"name": "normalize-path", | ||
"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.3.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/jonschlinkert/normalize-path", | ||
@@ -17,8 +17,18 @@ "author": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/normalize-path/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/normalize-path/blob/master/LICENSE-MIT" | ||
}, | ||
"files": ["index.js"], | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
}, | ||
"devDependencies": { | ||
"benchmarked": "^0.1.1", | ||
"mocha": "*" | ||
}, | ||
"keywords": [ | ||
@@ -34,16 +44,3 @@ "file", | ||
"unix" | ||
], | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
}, | ||
"devDependencies": { | ||
"benchmarked": "^0.1.1", | ||
"mocha": "*", | ||
"should": "^4.0.4", | ||
"verb": "^0.2.15" | ||
} | ||
] | ||
} |
@@ -5,4 +5,3 @@ # normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.svg)](http://badge.fury.io/js/normalize-path) | ||
## Install | ||
#### Install with [npm](npmjs.org) | ||
## Install with [npm](npmjs.org) | ||
@@ -13,8 +12,2 @@ ```bash | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -25,6 +18,6 @@ | ||
console.log(normalize('\\foo\\bar\\baz\\')); | ||
normalize('\\foo\\bar\\baz\\'); | ||
//=> '/foo/bar/baz' | ||
console.log(normalize('./foo/bar/baz/')); | ||
normalize('./foo/bar/baz/'); | ||
//=> './foo/bar/baz' | ||
@@ -36,9 +29,16 @@ ``` | ||
```js | ||
console.log(normalize('./foo/bar/baz/', false)); | ||
normalize('./foo/bar/baz/', false); | ||
//=> './foo/bar/baz/' | ||
console.log(normalize('foo\\bar\\baz\\', false)); | ||
normalize('foo\\bar\\baz\\', false); | ||
//=> 'foo/bar/baz/' | ||
``` | ||
## Run tests | ||
```bash | ||
npm i -d && npm test | ||
``` | ||
## Contributing | ||
@@ -55,3 +55,3 @@ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-path/issues). | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert, contributors. | ||
Copyright (c) 2015 Jon Schlinkert | ||
Released under the MIT license | ||
@@ -61,2 +61,2 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2014._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 23, 2015._ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
0
2669
3
15
1