/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
usecrate::error::VersionParsingError; usecrate::version::Version; use serde_json::{json, Value}; use std::convert::TryFrom;
pubtype Result<T, E = VersionParsingError> = std::result::Result<T, E>;
pubfn version_compare(args: &[Value]) -> Result<Value> { let curr_version = args.first().ok_or_else(|| {
VersionParsingError::ParseError("current version doesn't exist in jexl transform".into())
})?; let curr_version = curr_version.as_str().ok_or_else(|| {
VersionParsingError::ParseError("current version in jexl transform is not a string".into())
})?; let min_version = args.get(1).ok_or_else(|| {
VersionParsingError::ParseError("minimum version doesn't exist in jexl transform".into())
})?; let min_version = min_version.as_str().ok_or_else(|| {
VersionParsingError::ParseError("minimum version is not a string in jexl transform".into())
})?; let min_version = Version::try_from(min_version)?; let curr_version = Version::try_from(curr_version)?;
Ok(json!(if curr_version > min_version { 1
} elseif curr_version < min_version {
-1
} else { 0
}))
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.