From 61c29d197379d2fd44ad6c9449c3f3a42e5767f0 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 11 May 2024 02:48:32 +0200 Subject: [PATCH] Update to 1616c7b37d5076b3f3abbf8fe895d796e40c29fa --- src/classes/validationsingle.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/classes/validationsingle.gd b/src/classes/validationsingle.gd index 5bc337b..10eb244 100644 --- a/src/classes/validationsingle.gd +++ b/src/classes/validationsingle.gd @@ -144,6 +144,9 @@ func evaluate() -> bool: logger.warn("Can't determine if data contains values as data is not of type String or StringName") continue + # Set 'minimum_matches' to the amount of values if set to '-1' + if rule["minimum_matches"] == -1: rule["minimum_matches"] = rule["values"].size() + var successes: int = 0 for value in rule["values"]: if data.contains(value): @@ -277,7 +280,7 @@ func has_values(values: Array) -> CoreValidationSingle: rules.append({ "type": CoreTypes.ValidationType.HAS_VALUES, "values": values }) return self -## Ensures that [param data] contains at least <[code]minimum_matches[/code]> values.[br] +## Ensures that [param data] contains at least <[code]minimum_matches[/code]> (or all if set to [code]-1[/code]) values.[br] ## Applies to [String] & [StringName]. func contains(values: Array[String], minimum_matches: int = 1) -> CoreValidationSingle: rules.append({ "type": CoreTypes.ValidationType.HAS_VALUES, "values": values, "minimum_matches": minimum_matches })