Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (compare-versions-roku) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 functionFor 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 greater0- versions are equal1- first version is greater