1.0.0 • Published 6 years ago

superpath v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

superpath

About

superpath is a simple module to recrusive dissolve paths including environment varaibles like in a bash or bat script.

Installation

To install the package run:

$ npm install superpath

Usage

The following example shows how to use superpath

const superpath = require('superpath');
/*
  You can also set the environment in the constructor. Default is
  the os your running the code.
 */
const SuperPath = new superpath.SuperPath();

const env = {
    "HOMEDRIVE": "C:",
    "USERHOME": "C:/Users/test"
};

let path = "%USERHOME%/program/foo.txt";
path = SuperPath.dissolveFromEnvironemnt(path, env);
//path = C:/Users/test/program/foo.txt now!

/*
To solve a path from the current process.env state use the dissolve
function. Like in this example.
 */

path = "%USERHOME%/program/foo.txt";
path = SuperPath.dissolve(path);
//path = C:/Users/test/program/foo.txt now!
1.0.0

6 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago