summaryrefslogtreecommitdiff
path: root/lib/readline.js
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2019-06-03 00:48:53 +0200
committerSam Roberts <vieuxtech@gmail.com>2019-06-10 11:09:40 -0700
commit04633eeeb93c5a86a6635940eb4f34a7839ada11 (patch)
tree6e9f7de02606155b679df42ba706bf3028295947 /lib/readline.js
parentb17a70f639c476e5b293992b63d155f63a6a6a7f (diff)
downloadandroid-node-v8-04633eeeb93c5a86a6635940eb4f34a7839ada11.tar.gz
android-node-v8-04633eeeb93c5a86a6635940eb4f34a7839ada11.tar.bz2
android-node-v8-04633eeeb93c5a86a6635940eb4f34a7839ada11.zip
readline: error on falsy values for callback
It was intended, according to in-test comments and common behaviour, that callbacks be either `undefined` or a function, but falsy values were being accepted as meaning "no callback". PR-URL: https://github.com/nodejs/node/pull/28109 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/readline.js')
-rw-r--r--lib/readline.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/readline.js b/lib/readline.js
index c8d0a8040a..5cc2293882 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -121,7 +121,7 @@ function Interface(input, output, completer, terminal) {
input = input.input;
}
- if (completer && typeof completer !== 'function') {
+ if (completer !== undefined && typeof completer !== 'function') {
throw new ERR_INVALID_OPT_VALUE('completer', completer);
}