UNPKG

@berish/serber

Version:

Serializable and deserializable adaptive adapter with plugins

18 lines 774 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const linq_1 = require("@berish/linq"); function equalPaths(path1, path2) { return linq_1.default.from(path1).equalsValues(path2, m => m); } exports.equalPaths = equalPaths; function relativePath(path1, path2) { return linq_1.default.from(path1) .take(path1.length - 1) .reduce(prev => ['..', ...prev], path2); } exports.relativePath = relativePath; function getAbsolutePathByRelative(currentPath, relativePath) { return relativePath.reduce((prev, current) => current === '..' ? (prev.length > 0 ? prev.slice(0, prev.length - 1) : []) : [...prev, current], currentPath); } exports.getAbsolutePathByRelative = getAbsolutePathByRelative; //# sourceMappingURL=paths.js.map