summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline_new/utils/format_refs.js
blob: e217cd25413408aff3b5965c473a736b1aaa156a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants';

export default (refs, type) => {
  let fullName;

  return refs.map(ref => {
    if (type === BRANCH_REF_TYPE) {
      fullName = `refs/heads/${ref}`;
    } else if (type === TAG_REF_TYPE) {
      fullName = `refs/tags/${ref}`;
    }

    return {
      shortName: ref,
      fullName,
    };
  });
};