Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-go / lib / utils / checktag.js
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 const tslib_1 = require("tslib");
4 const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
5 const releaseFilter = /^v\d+\.\d+\.\d+$/;
6 async function checkLatestTag(repo, prefixFilter) {
7     const resp = await node_fetch_1.default(`https://api.github.com/repos/${repo}/tags`);
8     const data = await resp.json();
9     let tags = data.map(t => t.name);
10     if (prefixFilter) {
11         tags = tags
12             .filter(t => t.match(prefixFilter))
13             .map(t => t.replace(prefixFilter, ''));
14     }
15     tags = tags
16         .filter(t => t.match(releaseFilter));
17     return tags.length > 0
18         ? tags[0].replace(/^v/, '')
19         : '';
20 }
21 exports.default = checkLatestTag;
22 //# sourceMappingURL=checktag.js.map