Merge branch '261-libstd-add-function-to-test-whether-an-item-is-in-an-array' into 'master'

Resolve "libstd: add function to test whether an item is in an array"

Closes #261

See merge request Pmodules/src!238
This commit is contained in:
2024-05-02 15:26:18 +02:00
+10
View File
@@ -333,6 +333,16 @@ std::parse_yaml() {
}
}'
}
std::is_member_of_array(){
local -- item="$1"
local -n array="$2"
local -- el=''
for el in "${array[@]}"; do
[[ "${item}" == "${el}" ]] && return 0
done
return 1
}
# Local Variables:
# mode: sh
# sh-basic-offset: 8