The implementation of includes here seems like it likely does not match designer intent. It ends up producing bash code like:
[[ "${arr[@]}" =~ "${value}" ]]. Using as example values of arr = ["foo", "bar", "baz"] and value = "oo ba", this becomes [[ "foo bar baz" =~ "oo ba" ]] after parameter expansion, which returns 0 (true).
The sensible implementation is likely iterating over the array and testing each element, returning early if you find a match.
https://github.com/Ph0enixKM/Amber/blob/master/src/std/main.ab#L109-L112
The implementation of
includes
here seems like it likely does not match designer intent. It ends up producing bash code like:[[ "${arr[@]}" =~ "${value}" ]]
. Using as example values ofarr = ["foo", "bar", "baz"]
andvalue = "oo ba"
, this becomes[[ "foo bar baz" =~ "oo ba" ]]
after parameter expansion, which returns 0 (true).The sensible implementation is likely iterating over the array and testing each element, returning early if you find a match.