UNPKG

tsioc

Version:

tsioc is AOP, Ioc container, via typescript decorator

47 lines (45 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = require("../utils/index"); /** * convert path to absolute path. * * @export * @param {string} root * @param {string} pathstr * @returns {string} */ function toAbsolutePath(root, pathstr) { var path = require('path'); if (!root || path.isAbsolute(pathstr)) { return pathstr; } return path.join(root, pathstr); } exports.toAbsolutePath = toAbsolutePath; /** * convert src to absolute path src. * * @export * @param {string} root * @param {(string|string[])} src * @returns {(string|string[])} */ function toAbsoluteSrc(root, src) { if (index_1.isString(src)) { return prefixSrc(root, src); } else { return src.map(function (p) { return prefixSrc(root, p); }); } } exports.toAbsoluteSrc = toAbsoluteSrc; function prefixSrc(root, strSrc) { var prefix = ''; if (/^!/.test(strSrc)) { prefix = '!'; strSrc = strSrc.substring(1, strSrc.length); } return prefix + toAbsolutePath(root, strSrc); } //# sourceMappingURL=../sourcemaps/node/toAbsolute.js.map