Skip to content

Commit

Permalink
feat: transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Jul 30, 2023
1 parent a27acb9 commit dd940f5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions script/transform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
"regexp"
"strings"
)

// Simple regex to check string contains at least the main vers that is x.y.z
var re = regexp.MustCompile(`([1-9]+)\.([1-9]+)\.([1-9]+)`)

// The values received from the api are in the format of
// `channels/{{channel}}/release/{{version}}/`. This func
// strips the initial part and only gets the version
func stripVers(val string) string {
subs := strings.Split(val, "/")
return subs[len(subs)-2]
}

0 comments on commit dd940f5

Please sign in to comment.