index.js 244 B

123456789101112
  1. 'use strict';
  2. module.exports = function (str) {
  3. var isExtendedLengthPath = /^\\\\\?\\/.test(str);
  4. var hasNonAscii = /[^\x00-\x80]+/.test(str);
  5. if (isExtendedLengthPath || hasNonAscii) {
  6. return str;
  7. }
  8. return str.replace(/\\/g, '/');
  9. };