UNPKG

596 BJavaScriptView Raw
1'use strict';
2
3let FindRelease = function (heroku, app, search) {
4 return heroku.request({
5 path: `/apps/${app}/releases`,
6 partial: true,
7 headers: { 'Range': 'version ..; max=10, order=desc' }
8 }).then(search);
9};
10
11let FindByLatestOrId = function (heroku, app, release) {
12 let id = (release || 'current').toLowerCase();
13 id = id.startsWith('v') ? id.slice(1) : id;
14 if (id === 'current') {
15 return FindRelease(heroku, app, releases => releases[0]);
16 } else {
17 return heroku.get(`/apps/${app}/releases/${id}`);
18 }
19};
20
21module.exports = {
22 FindRelease,
23 FindByLatestOrId
24};
\No newline at end of file