function getStageNameList(stageList: List<StageConfig | RawStageConfig>) {
  if (stageList.isEmpty()) {
    return 'empty'
  } else {
    return stageList.map(s => s.name).join(',')
  }
}
function removeCounter(state: List<number>, action: RemoveCounterAction): List<number> {
  if(state.isEmpty()) {
    throw "no counters"
  }
  if(action.index >= state.size) {
    throw "index out of bounds"
  }
  if(action.index < 0) {
    throw "index out of bounds"
  }
    return state.remove(action.index)
}
Example #3
0
 .reduce((accumulator: List<[string, List<GitHubCommit>]>, currentCommit: GitHubCommit, currentIndex: number): List<[string, List<GitHubCommit>]> => {
     const isNotEmpty: boolean = ! accumulator.isEmpty();
     const previousGroup = accumulator.last();
     const maybePreviousAuthorName: Option<string> = isNotEmpty ? headOption(previousGroup) : None;
     return maybePreviousAuthorName
         .flatMap(previousAuthorName => {
             if (previousAuthorName === currentCommit.authorName) {
                 const currentCommitsByAuthor = previousGroup[1];
                 const index = accumulator.indexOf(previousGroup);
                 return new Some(accumulator.set(index, [ previousAuthorName, currentCommitsByAuthor.push(currentCommit) ]))
             } else {
                 return None;
             }
         })
         .getOrElse(() => accumulator.push([ currentCommit.authorName, List([ currentCommit ]) ]))
 }, List<[string, List<GitHubCommit>]>())