summaryrefslogtreecommitdiff
path: root/functions/utilities.zsh
diff options
context:
space:
mode:
authorBen Klein <robobenklein@gmail.com>2018-07-12 21:34:56 +0300
committerBen Klein <robobenklein@gmail.com>2018-07-12 22:37:33 +0300
commit45b0d68ec435a89ccc13193149a5bc306d449d04 (patch)
tree574929d441b8fa856a10caaa1af1f998ed4bf4a9 /functions/utilities.zsh
parent002f7b81a14def4ce7f1d5ea100825f0b8ebc464 (diff)
Replace `typeset` check with shellvar flag
More performance without changing functionality.
Diffstat (limited to 'functions/utilities.zsh')
-rwxr-xr-xfunctions/utilities.zsh4
1 files changed, 1 insertions, 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