UNPKG

@rashedmakkouk/dev-utils

Version:
22 lines (21 loc) 751 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /** Utilities */ const isArray_1 = __importDefault(require("lodash/isArray")); const path_1 = __importDefault(require("path")); /** * Joins a list of absolute and relative paths as string. * * @returns Joined path string. */ function joinPath(segments = [], options = {}) { if (!segments || !(0, isArray_1.default)(segments) || !segments.length) { return ''; } const { resolve } = options; return path_1.default[!resolve ? 'join' : 'resolve'](...segments).replace(/\\/g, '/'); } exports.default = joinPath;