path-string-prepend
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

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

/path-string-prepend/

    Package Sidebar

    Install

    npm i path-string-prepend

    Weekly Downloads

    69

    Version

    1.0.16

    License

    MIT

    Unpacked Size

    7.05 kB

    Total Files

    6

    Last publish

    Collaborators

    • kmalakoff