JSPM

  • Created
  • Published
  • Downloads 6361
  • Score
    100M100P100Q122494F
  • License MIT

Prepends a path to a platform-specfic delimited path string and removes duplicate paths

Package Exports

  • path-string-prepend
  • path-string-prepend/dist/cjs/index.cjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (path-string-prepend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

path-string-prepend

Prepends a path to a platform-specfic delimited path string and removes duplicate paths.

var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)
var DELIMITER = isWindows ? ';' : ':';

var prepend = once('path-string-prepend');
var assert = require('assert');

var envPath = ['other/path', 'another/path', 'install/path', 'other/path', 'another/path'].join(DELIMITER);
var pathsString = prepend(envPath, 'install/path');
assert(pathsString, ['install/path', 'other/path', 'another/path', 'other/path', 'another/path'].join(DELIMITER))