Comparing version 2.0.0 to 3.0.0
10
index.js
'use strict'; | ||
module.exports = input => { | ||
const isExtendedLengthPath = /^\\\\\?\\/.test(input); | ||
const hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex | ||
module.exports = path => { | ||
const isExtendedLengthPath = /^\\\\\?\\/.test(path); | ||
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex | ||
if (isExtendedLengthPath || hasNonAscii) { | ||
return input; | ||
return path; | ||
} | ||
return input.replace(/\\/g, '/'); | ||
return path.replace(/\\/g, '/'); | ||
}; |
{ | ||
"name": "slash", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Convert Windows backslash paths to slash paths", | ||
@@ -13,9 +13,10 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
@@ -25,12 +26,12 @@ "keywords": [ | ||
"seperator", | ||
"sep", | ||
"slash", | ||
"backslash", | ||
"windows", | ||
"win" | ||
"convert" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash) | ||
This was created since the `path` methods in Node outputs `\\` paths on Windows. | ||
This was created since the `path` methods in Node.js outputs `\\` paths on Windows. | ||
@@ -24,7 +24,7 @@ | ||
const str = path.join('foo', 'bar'); | ||
const string = path.join('foo', 'bar'); | ||
// Unix => foo/bar | ||
// Windows => foo\\bar | ||
slash(str); | ||
slash(string); | ||
// Unix => foo/bar | ||
@@ -41,3 +41,3 @@ // Windows => foo/bar | ||
Accepts a Windows backslash path and returns a slash path. | ||
Accepts a Windows backslash path and returns a path with forward slashes. | ||
@@ -44,0 +44,0 @@ |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3507
5
28
0
3