blob: 47483a2f4c330c949980cd4aa100883a526fa71f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# shellcheck shell=bash
# isDeclaredMap
# Tests if inputMapRef refers to a declared, associative array.
#
# Arguments:
# - inputMapRef: a reference to an associative array (not mutated)
#
# Returns 0 if the associative array is declared, 1 otherwise.
isDeclaredMap() {
# NOTE: We must dereference the name ref to get the type of the underlying variable.
# shellcheck disable=SC2034
local -nr inputMapRef="$1" && [[ ${!inputMapRef@a} =~ A ]]
}
|