From 45b0d68ec435a89ccc13193149a5bc306d449d04 Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Thu, 12 Jul 2018 14:34:56 -0400 Subject: [PATCH] Replace `typeset` check with shellvar flag More performance without changing functionality. --- functions/utilities.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 69fd2ec8..127007fb 100755 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -9,9 +9,7 @@ # Exits with 0 if a variable has been previously defined (even if empty) # Takes the name of a variable that should be checked. function defined() { - local varname="$1" - - typeset -p "$varname" > /dev/null 2>&1 + [[ ! -z "${(tP)1}" ]] } # Given the name of a variable and a default value, sets the variable