debian-mirror-gitlab/app/assets/javascripts/diffs/utils/merge_request.js
2021-03-08 18:12:59 +05:30

20 lines
389 B
JavaScript

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,
};
}