« get me outta code hell

tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--examples/list-scroll-form.js2
-rw-r--r--ui/DisplayElement.js4
-rw-r--r--ui/HorizontalBox.js2
-rw-r--r--ui/Root.js2
-rw-r--r--util/CommandLineInterfacer.js2
-rw-r--r--util/TelnetInterfacer.js4
-rw-r--r--util/count.js2
-rw-r--r--util/wrap.js2
8 files changed, 10 insertions, 10 deletions
diff --git a/examples/list-scroll-form.js b/examples/list-scroll-form.js
index cb7fa27..c015ddb 100644
--- a/examples/list-scroll-form.js
+++ b/examples/list-scroll-form.js
@@ -19,7 +19,7 @@ interfacer.getScreenSize().then(size => {
   list.w = root.contentW - 4
   list.h = root.contentH - 4
 
-  for (let item of ['Foo', 'Bar', 'Baz']) {
+  for (const item of ['Foo', 'Bar', 'Baz']) {
     const button = new Button(item)
     list.addInput(button)
 
diff --git a/ui/DisplayElement.js b/ui/DisplayElement.js
index 3a97ed9..75263ac 100644
--- a/ui/DisplayElement.js
+++ b/ui/DisplayElement.js
@@ -64,7 +64,7 @@ module.exports = class DisplayElement extends EventEmitter {
     // Runs fixLayout on this as well as all children.
 
     this.fixLayout()
-    for (let child of this.children) {
+    for (const child of this.children) {
       child.fixAllLayout()
     }
   }
@@ -72,7 +72,7 @@ module.exports = class DisplayElement extends EventEmitter {
   drawChildrenTo(writable) {
     // Draws all of the children to a writable.
 
-    for (let child of this.children) {
+    for (const child of this.children) {
       child.renderTo(writable)
     }
   }
diff --git a/ui/HorizontalBox.js b/ui/HorizontalBox.js
index fd43f8e..f92bf10 100644
--- a/ui/HorizontalBox.js
+++ b/ui/HorizontalBox.js
@@ -5,7 +5,7 @@ module.exports = class HorizontalBox extends DisplayElement {
 
   fixLayout() {
     let nextX = 0
-    for (let child of this.children) {
+    for (const child of this.children) {
       child.x = nextX
       nextX = child.right + 1
     }
diff --git a/ui/Root.js b/ui/Root.js
index d306a41..b0364e2 100644
--- a/ui/Root.js
+++ b/ui/Root.js
@@ -29,7 +29,7 @@ module.exports = class Root extends DisplayElement {
   handleData(buffer) {
     if (this.selected) {
       const els = this.selected.directAncestors.concat([this.selected])
-      for (let el of els) {
+      for (const el of els) {
         if (el instanceof FocusElement) {
           const shouldBreak = (el.keyPressed(buffer) === false)
           if (shouldBreak) {
diff --git a/util/CommandLineInterfacer.js b/util/CommandLineInterfacer.js
index 3f9d208..743ff5c 100644
--- a/util/CommandLineInterfacer.js
+++ b/util/CommandLineInterfacer.js
@@ -63,7 +63,7 @@ module.exports = class CommandLineInterfacer extends EventEmitter {
     const options = []
     let curOption = ''
     let commandCode = null
-    for (let val of buffer.slice(2)) {
+    for (const val of buffer.slice(2)) {
       if (48 <= val && val <= 57) { // 0124356789
         curOption = curOption.concat(val - 48)
       } else {
diff --git a/util/TelnetInterfacer.js b/util/TelnetInterfacer.js
index f9b1c23..410f8e9 100644
--- a/util/TelnetInterfacer.js
+++ b/util/TelnetInterfacer.js
@@ -54,7 +54,7 @@ module.exports = class TelnetInterfacer extends EventEmitter {
     inputLoop: while (true) {
       const data = await waitForData(this.socket)
 
-      for (let command of this.parseTelnetCommands(data)) {
+      for (const command of this.parseTelnetCommands(data)) {
         // WILL NAWS
         if (command[1] === 251 && command[2] === 31) {
           didWillNAWS = true
@@ -87,7 +87,7 @@ module.exports = class TelnetInterfacer extends EventEmitter {
       const values = Array.from(buffer.values())
       const commands = []
       const curCmd = [255]
-      for (let value of values) {
+      for (const value of values) {
         if (value === 255) { // IAC
           commands.push(Array.from(curCmd))
           curCmd.splice(1, curCmd.length)
diff --git a/util/count.js b/util/count.js
index 7df97a7..24c11b0 100644
--- a/util/count.js
+++ b/util/count.js
@@ -5,7 +5,7 @@ module.exports = function count(arr) {
 
   const map = new Map()
 
-  for (let item of arr) {
+  for (const item of arr) {
     if (map.has(item)) {
       map.set(item, map.get(item) + 1)
     } else {
diff --git a/util/wrap.js b/util/wrap.js
index 78e5233..3c381d4 100644
--- a/util/wrap.js
+++ b/util/wrap.js
@@ -7,7 +7,7 @@ module.exports = function wrap(str, width) {
 
   let curLine = words[0]
 
-  for (let word of words.slice(1)) {
+  for (const word of words.slice(1)) {
     if (curLine.length + word.length > width) {
       lines.push(curLine)
       curLine = word