UNPKG

@git-temporal/git-temporal-react

Version:

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

32 lines (31 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const dates_1 = require("./dates"); function getUTCDateOfCommit(commit) { return dates_1.dateFromEpochDate(commit.authorDate); } exports.getUTCDateOfCommit = getUTCDateOfCommit; function getHourOfCommit(commit) { const d = getUTCDateOfCommit(commit); return d.getHours(); } exports.getHourOfCommit = getHourOfCommit; function filterCommitsForSpan(commits, dateStart, dateEnd) { return commits.filter(commit => { const commitDate = getUTCDateOfCommit(commit); return dateStart <= commitDate && commitDate <= dateEnd; }); } exports.filterCommitsForSpan = filterCommitsForSpan; function first20CommitsEqual(commitsA, commitsB) { if (commitsA.length !== commitsB.length) { return false; } for (let i = 0; i < 20 && i < commitsA.length; i++) { if (commitsA[i].id !== commitsB[i].id) { return false; } } return true; } exports.first20CommitsEqual = first20CommitsEqual;