UNPKG

typescript-transform-paths

Version:

Transforms module resolution paths using TypeScript path mapping and/or custom paths

12 lines 730 B
import url from "node:url"; import path from "node:path"; /* ****************************************************************************************************************** * * General Utilities & Helpers * ****************************************************************************************************************** */ export const isURL = (s) => !!s && (!!url.parse(s).host || !!url.parse(s).hostname); export const isBaseDir = (baseDir, testDir) => { const relative = path.relative(baseDir, testDir); return relative ? !relative.startsWith("..") && !path.isAbsolute(relative) : true; }; export const maybeAddRelativeLocalPrefix = (p) => (p[0] === "." ? p : `./${p}`); //# sourceMappingURL=general-utils.js.map