Comparing version 1.0.0 to 2.0.0
10
index.js
'use strict'; | ||
module.exports = function (str) { | ||
var isExtendedLengthPath = /^\\\\\?\\/.test(str); | ||
var hasNonAscii = /[^\x00-\x80]+/.test(str); | ||
module.exports = input => { | ||
const isExtendedLengthPath = /^\\\\\?\\/.test(input); | ||
const hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex | ||
if (isExtendedLengthPath || hasNonAscii) { | ||
return str; | ||
return input; | ||
} | ||
return str.replace(/\\/g, '/'); | ||
return input.replace(/\\/g, '/'); | ||
}; |
{ | ||
"name": "slash", | ||
"version": "1.0.0", | ||
"description": "Convert Windows backslash paths to slash paths", | ||
"keywords": [ | ||
"path", | ||
"seperator", | ||
"sep", | ||
"slash", | ||
"backslash", | ||
"windows", | ||
"win" | ||
], | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"repository": "sindresorhus/slash", | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
"index.js" | ||
] | ||
"name": "slash", | ||
"version": "2.0.0", | ||
"description": "Convert Windows backslash paths to slash paths", | ||
"license": "MIT", | ||
"repository": "sindresorhus/slash", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"path", | ||
"seperator", | ||
"sep", | ||
"slash", | ||
"backslash", | ||
"windows", | ||
"win" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -12,5 +12,5 @@ # slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash) | ||
```sh | ||
$ npm install --save slash | ||
``` | ||
$ npm install slash | ||
``` | ||
@@ -21,6 +21,6 @@ | ||
```js | ||
var path = require('path'); | ||
var slash = require('slash'); | ||
const path = require('path'); | ||
const slash = require('slash'); | ||
var str = path.join('foo', 'bar'); | ||
const str = path.join('foo', 'bar'); | ||
// Unix => foo/bar | ||
@@ -46,2 +46,2 @@ // Windows => foo\\bar | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
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
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
2819
4
2