summaryrefslogtreecommitdiff
path: root/functions/utilities.zsh
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2018-07-13 20:25:45 +0300
committerGitHub <noreply@github.com>2018-07-13 20:25:45 +0300
commita7b3f310d3c1e5306332dd15401efb9631c76bed (patch)
treef86464cadab0cfa107e9137d0141a4511de2db77 /functions/utilities.zsh
parente1a420b5d20b11da108b202eb7020437869a28a8 (diff)
parent45b0d68ec435a89ccc13193149a5bc306d449d04 (diff)
Merge pull request #905 from robobenklein/robobenklein/defined-variable-performance-hotfix
[performance] Defined function 2-20 times speedup
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