Comparing version 0.1.0 to 0.2.1
@@ -10,9 +10,6 @@ /*! | ||
var path = require('path'); | ||
var normalize = require('normalize-path'); | ||
module.exports = function unixify(fp, normalize) { | ||
if (normalize || process.platform === 'win32' || path.sep === '\\') { | ||
return fp.replace(/^[A-Z]:\\?|[\\\/]+/gi, '/'); | ||
} | ||
return fp; | ||
module.exports = function unixify(fp) { | ||
return normalize(fp).replace(/^\w+:/, ''); | ||
}; |
{ | ||
"name": "unixify", | ||
"description": "Convert Windows file paths to Unix-like paths (`/`)", | ||
"version": "0.1.0", | ||
"description": "Convert Windows file paths to unix paths.", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jonschlinkert/unixify", | ||
"author": { | ||
"name": "Jon Schlinkert", | ||
"url": "https://github.com/jonschlinkert" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jonschlinkert/unixify.git" | ||
}, | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": "jonschlinkert/unixify", | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/unixify/issues" | ||
}, | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/unixify/blob/master/LICENSE-MIT" | ||
}, | ||
"license": "MIT", | ||
"files": ["index.js"], | ||
"main": "index.js", | ||
@@ -26,9 +18,12 @@ "engines": { | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"normalize-path": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*" | ||
"mocha": "*" | ||
}, | ||
"keywords": [ | ||
"backslash", | ||
"directory", | ||
@@ -38,8 +33,30 @@ "file", | ||
"fix", | ||
"forward", | ||
"fp", | ||
"fs", | ||
"normalize", | ||
"path", | ||
"slash", | ||
"slashes", | ||
"trailing", | ||
"unix", | ||
"urix", | ||
"windows" | ||
] | ||
], | ||
"verb": { | ||
"related": { | ||
"description": "Other useful libraries for working with paths in node.js:", | ||
"list": [ | ||
"contains-path", | ||
"ends-with", | ||
"is-absolute", | ||
"is-relative", | ||
"normalize-path", | ||
"parse-filepath", | ||
"path-ends-with", | ||
"path-segments", | ||
"rewrite-ext" | ||
] | ||
} | ||
} | ||
} |
# unixify [![NPM version](https://badge.fury.io/js/unixify.svg)](http://badge.fury.io/js/unixify) | ||
> Convert Windows file paths to Unix-like paths (`/`) | ||
> Convert Windows file paths to unix paths. | ||
## Install with [npm](npmjs.org) | ||
Install with [npm](https://www.npmjs.com/) | ||
```bash | ||
npm i unixify --save | ||
```sh | ||
$ npm i unixify --save | ||
``` | ||
@@ -19,42 +19,58 @@ | ||
unixify('F:\\one\\two\\three'); | ||
unixify('one\\two\\//three'); | ||
//=> 'one/two/three' | ||
unixify('C:\\one\\two\\three'); | ||
//=> '/one/two/three' | ||
unixify('F:\\//one\\two\\three'); | ||
//=> '//one/two/three' | ||
unixify('C:\\//one\\//two\\//three'); | ||
//=> '/one/two/three' | ||
unixify('F:\\//one\\two\\three'); | ||
//=> '//one/two/three' | ||
unixify('C:\\//one\\two\\three'); | ||
//=> '/one/two/three' | ||
unixify('one\\two\\//three'); | ||
//=> 'one/two/three' | ||
unixify('C:\\//one\\two\\//three'); | ||
//=> '//one/two/three' | ||
//=> '/one/two/three' | ||
``` | ||
## Run tests | ||
## Related | ||
Other useful libraries for working with paths in node.js: | ||
* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path) | ||
* [ends-with](https://www.npmjs.com/package/ends-with): Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for… [more](https://www.npmjs.com/package/ends-with) | [homepage](https://github.com/jonschlinkert/ends-with) | ||
* [is-absolute](https://www.npmjs.com/package/is-absolute): Return true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute) | ||
* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative) | ||
* [normalize-path](https://www.npmjs.com/package/normalize-path): Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a… [more](https://www.npmjs.com/package/normalize-path) | [homepage](https://github.com/jonschlinkert/normalize-path) | ||
* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Parse a filepath into an object. Falls back on the native node.js `path.parse` method if… [more](https://www.npmjs.com/package/parse-filepath) | [homepage](https://github.com/jonschlinkert/parse-filepath) | ||
* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with) | ||
* [path-segments](https://www.npmjs.com/package/path-segments): Get n specific segments of a file path, e.g. first 2, last 3, etc. | [homepage](https://github.com/jonschlinkert/path-segments) | ||
* [rewrite-ext](https://www.npmjs.com/package/rewrite-ext): Automatically re-write the destination extension of a filepath based on the source extension. e.g … [more](https://www.npmjs.com/package/rewrite-ext) | [homepage](https://github.com/jonschlinkert/rewrite-ext) | ||
## Running tests | ||
Install dev dependencies: | ||
```bash | ||
node i -d && mocha | ||
```sh | ||
$ npm i -d && npm test | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/unixify/issues) | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/unixify/issues/new). | ||
## Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert | ||
Released under the MIT license | ||
Copyright © 2015 Jon Schlinkert | ||
Released under the MIT license. | ||
*** | ||
_This file was generated by [verb](https://github.com/assemble/verb) on December 22, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 04, 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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
1
75
5827
1
4
11
1
+ Addednormalize-path@^2.0.0
+ Addednormalize-path@2.1.1(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)