File: index.js

package info (click to toggle)
node-slash 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 104 kB
  • ctags: 3
  • sloc: makefile: 2; sh: 2
file content (11 lines) | stat: -rw-r--r-- 244 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
'use strict';
module.exports = function (str) {
	var isExtendedLengthPath = /^\\\\\?\\/.test(str);
	var hasNonAscii = /[^\x00-\x80]+/.test(str);

	if (isExtendedLengthPath || hasNonAscii) {
		return str;
	}

	return str.replace(/\\/g, '/');
};