feat: add getLastModifiedDate

This commit is contained in:
Nicolás Quiroz 2022-12-13 14:19:57 -03:00
parent d07464b8b0
commit 01c6252754
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import { LAST_COMMIT_BASE_URL } from '../constants';
export const getLastModifiedDate = async (filePath: string) =>
fetch(`${LAST_COMMIT_BASE_URL}${filePath}/index.md&page=1&per_page=1`)
.then(res => res.json())
.then(commits => commits[0].commit.committer.date)
.catch(_ =>
fetch(`${LAST_COMMIT_BASE_URL}${filePath}.md&page=1&per_page=1`)
.then(res => res.json())
.then(commits => commits[0].commit.committer.date)
);

View File

@ -4,6 +4,7 @@ export { fetchLatestReleaseVersionAndName } from './fetchLatestReleaseVersionAnd
export { fetchXMLData } from './fetchXMLData';
export { getChecksum } from './getChecksum';
export { getKebabCaseFromName } from './getKebabCaseFromName';
export { getLastModifiedDate } from './getLastModifiedDate';
export { getLatestBinaryURL } from './getLatestBinaryURL';
export { getOS } from './getOS';
export { getParsedDate } from './getParsedDate';