Socket
Socket
Sign inDemoInstall

slash

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

index.d.ts

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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc