debian-mirror-gitlab/app/assets/javascripts/diffs/utils/merge_request.js

21 lines
389 B
JavaScript
Raw Normal View History

2021-03-08 18:12:59 +05:30
const endpointRE = /^(\/?(.+?)\/(.+?)\/-\/merge_requests\/(\d+)).*$/i;
export function getDerivedMergeRequestInformation({ endpoint } = {}) {
let mrPath;
let userOrGroup;
let project;
let id;
const matches = endpointRE.exec(endpoint);
if (matches) {
[, mrPath, userOrGroup, project, id] = matches;
}
return {
mrPath,
userOrGroup,
project,
id,
};
}