summaryrefslogtreecommitdiff
path: root/lib/internal/fs/utils.js
diff options
context:
space:
mode:
authorWeijia Wang <starkwang@126.com>2019-03-18 19:31:07 +0800
committerWeijia Wang <381152119@qq.com>2019-03-21 21:38:02 +0800
commitc8d3a73c8b673792e315759b70cf4822b64b3e45 (patch)
tree39f35c7327e82964acf66f63c3e9d1c919c3382b /lib/internal/fs/utils.js
parent1935625df4f56bd77c57ec100a9222c77e9d440c (diff)
downloadandroid-node-v8-c8d3a73c8b673792e315759b70cf4822b64b3e45.tar.gz
android-node-v8-c8d3a73c8b673792e315759b70cf4822b64b3e45.tar.bz2
android-node-v8-c8d3a73c8b673792e315759b70cf4822b64b3e45.zip
lib: use Array#includes instead of Array#indexOf
PR-URL: https://github.com/nodejs/node/pull/26732 Refs: https://github.com/nodejs/node/issues/26568 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/internal/fs/utils.js')
-rw-r--r--lib/internal/fs/utils.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index 8a9d4d3572..0c5ce1ecb7 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -191,8 +191,8 @@ function nullCheck(path, propName, throwError = true) {
// We can only perform meaningful checks on strings and Uint8Arrays.
if (!pathIsString && !pathIsUint8Array ||
- pathIsString && path.indexOf('\u0000') === -1 ||
- pathIsUint8Array && path.indexOf(0) === -1) {
+ pathIsString && !path.includes('\u0000') ||
+ pathIsUint8Array && !path.includes(0)) {
return;
}