mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-24 00:27:59 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user