env-cmd/dist/utils.js
Todd Bluhm bbc4b78ad2
Convert over to using ts-standard
- Removed all the various eslint dependencies and added ts-standard
- Updated Readme file with some minor changes
- Updated dist folder to have one level again
2019-08-29 23:39:32 -05:00

31 lines
895 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const os = require("os");
/**
* A simple function for resolving the path the user entered
*/
function resolveEnvFilePath(userPath) {
// Make sure a home directory exist
const home = os.homedir();
if (home !== undefined) {
userPath = userPath.replace(/^~($|\/|\\)/, `${home}$1`);
}
return path.resolve(process.cwd(), userPath);
}
exports.resolveEnvFilePath = resolveEnvFilePath;
/**
* A simple function that parses a comma separated string into an array of strings
*/
function parseArgList(list) {
return list.split(',');
}
exports.parseArgList = parseArgList;
/**
* A simple function to test if the value is a promise
*/
function isPromise(value) {
return value !== undefined && typeof value.then === 'function';
}
exports.isPromise = isPromise;