tools: fix redeclared vars in doc/json.js
authorRich Trott <rtrott@gmail.com>
Wed, 3 Feb 2016 00:20:44 +0000 (16:20 -0800)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
PR-URL: https://github.com/nodejs/node/pull/5047
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
tools/doc/json.js

index 66eb822..d6cbbb0 100644 (file)
@@ -184,14 +184,13 @@ function processList(section) {
     var type = tok.type;
     if (type === 'space') return;
     if (type === 'list_item_start') {
+      var n = {};
       if (!current) {
-        var n = {};
         values.push(n);
         current = n;
       } else {
         current.options = current.options || [];
         stack.push(current);
-        var n = {};
         current.options.push(n);
         current = n;
       }
@@ -478,14 +477,14 @@ function deepCopy(src, dest) {
 function deepCopy_(src) {
   if (!src) return src;
   if (Array.isArray(src)) {
-    var c = new Array(src.length);
+    const c = new Array(src.length);
     src.forEach(function(v, i) {
       c[i] = deepCopy_(v);
     });
     return c;
   }
   if (typeof src === 'object') {
-    var c = {};
+    const c = {};
     Object.keys(src).forEach(function(k) {
       c[k] = deepCopy_(src[k]);
     });