From 1ab244a065b22a5a54f173ef134706e35750ab5b Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sat, 1 Sep 2018 21:40:24 +0800 Subject: [PATCH 1/2] lib: refactor variable declarations --- lib/internal/fs/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index acc566e37bb4bf..2bf5be0c0d5dba 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -112,14 +112,14 @@ for (const name of Reflect.ownKeys(Dirent.prototype)) { } function copyObject(source) { - var target = {}; - for (var key in source) + const target = {}; + for (const key in source) target[key] = source[key]; return target; } function getDirents(path, [names, types], callback) { - var i; + let i; if (typeof callback == 'function') { const len = names.length; let toFinish = 0; From 41d2f70fa5d28a732d7797a418a8965722ce5157 Mon Sep 17 00:00:00 2001 From: ZYSzys <17367077526@163.com> Date: Sun, 2 Sep 2018 10:04:49 +0800 Subject: [PATCH 2/2] lib: change == to === --- lib/internal/fs/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index 2bf5be0c0d5dba..f0abddcc3a695c 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -120,7 +120,7 @@ function copyObject(source) { function getDirents(path, [names, types], callback) { let i; - if (typeof callback == 'function') { + if (typeof callback === 'function') { const len = names.length; let toFinish = 0; for (i = 0; i < len; i++) {