Skip to content

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

License

Notifications You must be signed in to change notification settings

kmalakoff/path-string-prepend

Repository files navigation

path-string-prepend

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

var DELIMITER = process.platform === 'win32' ? ';' : ':';

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published