Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Dec 8, 2024
1 parent 74cb3fc commit 6339769
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/release.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,24 @@ export class Release
@version = version

# The latest release.
Object.defineProperty @, "latest",
get: -> @data.at(0) or null
Object.defineProperty @, "latest", get: -> @data.at(0) or null

# Value indicating whether this release exists.
Object.defineProperty @::, "exists",
get: -> Release.data.some (release) => release.version is @version
Object.defineProperty @::, "exists", get: -> Release.data.some (release) => release.version is @version

# Value indicating whether this release is provided as source code.
Object.defineProperty @::, "isSource",
get: -> not @getAsset process.platform
Object.defineProperty @::, "isSource", get: -> not @getAsset process.platform

# The associated Git tag.
Object.defineProperty @::, "tag",
get: ->
{major, minor, patch} = new SemVer @version
if patch > 0 then "#{major}.#{minor}.#{patch}" else "#{major}.#{minor}"
Object.defineProperty @::, "tag", get: ->
{major, minor, patch} = new SemVer @version
if patch > 0 then "#{major}.#{minor}.#{patch}" else "#{major}.#{minor}"

# The download URL.
Object.defineProperty @::, "url",
get: ->
asset = @getAsset process.platform
path = if asset then "releases/download/#{@tag}/#{asset.file}" else "archive/refs/tags/#{@tag}.zip"
new URL path, Release.baseUrl
Object.defineProperty @::, "url", get: ->
asset = @getAsset process.platform
path = if asset then "releases/download/#{@tag}/#{asset.file}" else "archive/refs/tags/#{@tag}.zip"
new URL path, Release.baseUrl

# Finds a release that matches the specified version constraint.
@find: (constraint) -> (@data.find (release) -> semver.satisfies release.version, constraint) or null
Expand Down

0 comments on commit 6339769

Please sign in to comment.