Эх сурвалжийг харах

Decaf cleanup: unnecessary Array.from()

Eric Mc Sween 6 жил өмнө
parent
commit
3385ec5f26

+ 4 - 7
services/document-updater/app/js/HttpController.js

@@ -6,7 +6,6 @@
 // Fix any style issues and re-enable lint.
 // Fix any style issues and re-enable lint.
 /*
 /*
  * decaffeinate suggestions:
  * decaffeinate suggestions:
- * DS101: Remove unnecessary use of Array.from
  * DS102: Remove unnecessary code created because of implicit returns
  * DS102: Remove unnecessary code created because of implicit returns
  * DS103: Rewrite code to no longer use __guard__
  * DS103: Rewrite code to no longer use __guard__
  * DS207: Consider shorter variations of null checks
  * DS207: Consider shorter variations of null checks
@@ -69,7 +68,7 @@ module.exports = HttpController = {
 
 
   _getTotalSizeOfLines(lines) {
   _getTotalSizeOfLines(lines) {
     let size = 0
     let size = 0
-    for (const line of Array.from(lines)) {
+    for (const line of lines) {
       size += line.length + 1
       size += line.length + 1
     }
     }
     return size
     return size
@@ -89,10 +88,8 @@ module.exports = HttpController = {
     logger.log({ project_id, exclude: excludeItems }, 'getting docs via http')
     logger.log({ project_id, exclude: excludeItems }, 'getting docs via http')
     const timer = new Metrics.Timer('http.getAllDocs')
     const timer = new Metrics.Timer('http.getAllDocs')
     const excludeVersions = {}
     const excludeVersions = {}
-    for (const item of Array.from(excludeItems)) {
-      const [id, version] = Array.from(
-        item != null ? item.split(':') : undefined
-      )
+    for (const item of excludeItems) {
+      const [id, version] = item.split(':')
       excludeVersions[id] = version
       excludeVersions[id] = version
     }
     }
     logger.log(
     logger.log(
@@ -113,7 +110,7 @@ module.exports = HttpController = {
           logger.log(
           logger.log(
             {
             {
               project_id,
               project_id,
-              result: Array.from(result).map((doc) => `${doc._id}:${doc.v}`)
+              result: result.map((doc) => `${doc._id}:${doc.v}`)
             },
             },
             'got docs via http'
             'got docs via http'
           )
           )