UNPKG

deth

Version:

Ethereum node focused on Developer Experience

30 lines (29 loc) 872 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); function makePath(value) { if (!path_1.isAbsolute(value)) { throw new TypeError(`Path ${value} is not absolute!`); } return value; } exports.makePath = makePath; /** * if path is relative use basePath to create absolute one * NOTE: if path is already absolute it will just use it */ function relativePathToPath(relativePath, basePath) { if (path_1.isAbsolute(relativePath)) { return makePath(relativePath); } return makePath(path_1.join(basePath, relativePath)); } exports.relativePathToPath = relativePathToPath; function getBaseName(path) { return path_1.basename(path); } exports.getBaseName = getBaseName; function getDirName(path) { return makePath(path_1.dirname(path)); } exports.getDirName = getDirName;