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