From d45224364cf0e891d091c9052a1e39fe5157aaf3 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 23 Dec 2023 10:28:20 -0700 Subject: [PATCH] feat: Add nextflow_release function WIth the goal being to convert Octokit data into NextflowRelease objects, create a function that can do that in one line. --- src/NextflowRelease.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/NextflowRelease.ts b/src/NextflowRelease.ts index b2bdaee..4cc0a17 100644 --- a/src/NextflowRelease.ts +++ b/src/NextflowRelease.ts @@ -8,6 +8,21 @@ export type NextflowRelease = { allBinaryURL: string } +/** + * Converts the raw OctoKit data into a structured NextflowRelease + * @param data A "release" data struct from OctoKit + * @returns `data` converted into a `NextflowRelease` + */ +export function nextflow_release(data: object) { + const nf_release: NextflowRelease = { + versionNumber: data["tag_name"], + isEdge: data["prerelease"], + binaryURL: nextflow_bin_url(data, false), + allBinaryURL: nextflow_bin_url(data, true) + } + return nf_release +} + /** * Gets the download URL of a Nextflow binary * @param release A "release" data struct from OctoKit