Sha256: 202cf63677ddcac13e71d66d2e98c8f07aad10789845ade028e5be755b7abf3a

Contents?: true

Size: 1 KB

Versions: 62

Compression:

Stored size: 1 KB

Contents

/*!
 * normalize-path <https://github.com/jonschlinkert/normalize-path>
 *
 * Copyright (c) 2014-2018, Jon Schlinkert.
 * Released under the MIT License.
 */

module.exports = function(path, stripTrailing) {
  if (typeof path !== 'string') {
    throw new TypeError('expected path to be a string');
  }

  if (path === '\\' || path === '/') return '/';

  var len = path.length;
  if (len <= 1) return path;

  // ensure that win32 namespaces has two leading slashes, so that the path is
  // handled properly by the win32 version of path.parse() after being normalized
  // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
  var prefix = '';
  if (len > 4 && path[3] === '\\') {
    var ch = path[2];
    if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
      path = path.slice(2);
      prefix = '//';
    }
  }

  var segs = path.split(/[/\\]+/);
  if (stripTrailing !== false && segs[segs.length - 1] === '') {
    segs.pop();
  }
  return prefix + segs.join('/');
};

Version data entries

62 entries across 55 versions & 13 rubygems

Version Path
rapid_stack-0.2.0 templates/frontend/node_modules/normalize-path/index.js
rapid_stack-0.1.1 templates/FrontEnd/node_modules/normalize-path/index.js
rapid_stack-0.1.0 templates/FrontEnd/node_modules/normalize-path/index.js
optimacms-0.1.61 spec/dummy/node_modules/normalize-path/index.js
decidim-0.26.8 packages/eslint-config/node_modules/normalize-path/index.js
disco_app-0.18.0 test/dummy/node_modules/normalize-path/index.js
disco_app-0.18.2 test/dummy/node_modules/normalize-path/index.js
epuber-stylus-source-0.56.0 vendor/node_modules/normalize-path/index.js
appmap-0.72.2 ./node_modules/normalize-path/index.js
appmap-0.72.1 ./node_modules/normalize-path/index.js
appmap-0.72.0 ./node_modules/normalize-path/index.js
appmap-0.71.0 ./node_modules/normalize-path/index.js
disco_app-0.16.1 test/dummy/node_modules/normalize-path/index.js
appmap-0.70.2 ./node_modules/normalize-path/index.js
appmap-0.70.1 ./node_modules/normalize-path/index.js
appmap-0.70.0 ./node_modules/normalize-path/index.js
appmap-0.69.0 ./node_modules/normalize-path/index.js
appmap-0.68.2 ./node_modules/normalize-path/index.js
appmap-0.68.1 ./node_modules/normalize-path/index.js
disco_app-0.15.2 test/dummy/node_modules/normalize-path/index.js