compare-versions-roku

1.0.1 • Public • Published

compare-versions-roku

Compare semver version strings to find greater, equal or lesser.

Based on https://github.com/omichelsen/compare-versions.

Installation

with kopytko-packager

When using kopytko-packager you can simly define this package as a dependecy.

npm i compare-versions-roku

without kopytko-packager

Copy compareVersions.brs file from this repository to your project.

Remember that it uses also the getProperty, getType, and ternary functions from the kopytko-utils, so copy it along with it, or create a similar one.

Usage

' @import /components/libs/compareVersions.brs from compare-versions-roku

function areVersionsTheSame() as Boolean
  return compareVersions("1.2.0", "1.2")
end function

For more examples, you can see test cases.

Documentation

Currently, there is only compareVersions function. It will return 1 if the first version is greater, 0 if the versions are equal, and -1 if the second version is greater:

compareVersions(v1, v2)

params:

  • v1 (roString) - first version string
  • v2 (roString) - second version string

returns (roInteger):

  • -1 - the second version is greater
  • 0 - versions are equal
  • 1 - first version is greater

Package Sidebar

Install

npm i compare-versions-roku

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

6.95 kB

Total Files

4

Last publish

Collaborators

  • blazej.chelkowski