UNPKG

@stackend/api

Version:

JS bindings to api.stackend.com

24 lines 840 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTagsFromPathname = exports.normalizeTags = void 0; var request_1 = require("../request"); /** * Normalize tags (order) * @param tags */ function normalizeTags(tags) { return tags ? tags.sort() : []; } exports.normalizeTags = normalizeTags; /** * Give a pathname (URL), find the tags if any, returns empty array if none is found * @param pathname */ function getTagsFromPathname(_a) { var pathname = _a.pathname; var anchor = (0, request_1.parseAnchor)(pathname); var tagsAnchor = (0, request_1.getAnchorPart)(anchor, request_1.AnchorType.TAGS); return normalizeTags(tagsAnchor === null || tagsAnchor === void 0 ? void 0 : tagsAnchor.tags); } exports.getTagsFromPathname = getTagsFromPathname; //# sourceMappingURL=index.js.map