UNPKG

@controlplane/cli

Version:

Control Plane Corporation CLI

32 lines 898 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLastPartOfLink = exports.parentLink = exports.linksOf = void 0; function get(target, prop) { for (let lnk of target) { if (lnk.rel == prop) { return lnk.href; } } return undefined; } function linksOf(linked) { return new Proxy(linked.links, { get: get, }); } exports.linksOf = linksOf; function parentLink(link) { let i = link.lastIndexOf('/'); return link.substring(0, i); } exports.parentLink = parentLink; /** * @param link A string that contains slashes indicating that it is a link * @returns The last part of the link string after the last slash */ function getLastPartOfLink(link) { const parts = link.split('/'); return parts[parts.length - 1]; } exports.getLastPartOfLink = getLastPartOfLink; //# sourceMappingURL=links.js.map