diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-01-25 09:37:34 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-01-25 09:37:34 +0100 |
commit | b75a5717a084c9e5a727c2e960f2b910abcb5ace (patch) | |
tree | a9dcd00c428aeba011e9a445b96aacad962a1f3d /common | |
parent | 7218849ae2f43aee6b3462a30e07caf5bac3d22b (diff) | |
download | browser-extension-b75a5717a084c9e5a727c2e960f2b910abcb5ace.tar.gz browser-extension-b75a5717a084c9e5a727c2e960f2b910abcb5ace.zip |
add a repo querying HTML interface
Diffstat (limited to 'common')
-rw-r--r-- | common/entities.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/entities.js b/common/entities.js index b70661f..3ccbf04 100644 --- a/common/entities.js +++ b/common/entities.js @@ -101,6 +101,17 @@ function get_newest_version(versioned_item) #EXPORT get_newest_version AS get_newest /* + * Returns true if the argument is a nonempty array of numbers without trailing + * zeros. + */ +function is_valid_version(version) { + return Array.isArray(version) && version.length > 0 && + version.every(n => typeof n === "number") && + version[version.length - 1] !== 0; +} +#EXPORT is_valid_version + +/* * item is a definition of a resource or mapping. Yield all file references * (objects with `file` and `sha256` properties) this definition has. */ |