Просмотр исходного кода

Decaf cleanup: remove Array.from()

Eric Mc Sween 6 лет назад
Родитель
Сommit
819aa378d9
1 измененных файлов с 8 добавлено и 9 удалено
  1. 8 9
      services/document-updater/app/js/ProjectManager.js

+ 8 - 9
services/document-updater/app/js/ProjectManager.js

@@ -7,7 +7,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
  * DS207: Consider shorter variations of null checks
  * DS207: Consider shorter variations of null checks
  * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
@@ -30,7 +29,7 @@ module.exports = ProjectManager = {
     const timer = new Metrics.Timer('projectManager.flushProjectWithLocks')
     const timer = new Metrics.Timer('projectManager.flushProjectWithLocks')
     const callback = function (...args) {
     const callback = function (...args) {
       timer.done()
       timer.done()
-      return _callback(...Array.from(args || []))
+      return _callback(...args)
     }
     }
 
 
     return RedisManager.getDocIdsInProject(project_id, function (
     return RedisManager.getDocIdsInProject(project_id, function (
@@ -42,7 +41,7 @@ module.exports = ProjectManager = {
       }
       }
       const jobs = []
       const jobs = []
       const errors = []
       const errors = []
-      for (const doc_id of Array.from(doc_ids || [])) {
+      for (const doc_id of doc_ids) {
         ;((doc_id) =>
         ;((doc_id) =>
           jobs.push((callback) =>
           jobs.push((callback) =>
             DocumentManager.flushDocIfLoadedWithLock(
             DocumentManager.flushDocIfLoadedWithLock(
@@ -92,7 +91,7 @@ module.exports = ProjectManager = {
     )
     )
     const callback = function (...args) {
     const callback = function (...args) {
       timer.done()
       timer.done()
-      return _callback(...Array.from(args || []))
+      return _callback(...args)
     }
     }
 
 
     return RedisManager.getDocIdsInProject(project_id, function (
     return RedisManager.getDocIdsInProject(project_id, function (
@@ -104,7 +103,7 @@ module.exports = ProjectManager = {
       }
       }
       const jobs = []
       const jobs = []
       const errors = []
       const errors = []
-      for (const doc_id of Array.from(doc_ids || [])) {
+      for (const doc_id of doc_ids) {
         ;((doc_id) =>
         ;((doc_id) =>
           jobs.push((callback) =>
           jobs.push((callback) =>
             DocumentManager.flushAndDeleteDocWithLock(
             DocumentManager.flushAndDeleteDocWithLock(
@@ -210,7 +209,7 @@ module.exports = ProjectManager = {
     )
     )
     const callback = function (...args) {
     const callback = function (...args) {
       timer.done()
       timer.done()
-      return _callback(...Array.from(args || []))
+      return _callback(...args)
     }
     }
 
 
     return RedisManager.checkOrSetProjectState(
     return RedisManager.checkOrSetProjectState(
@@ -243,7 +242,7 @@ module.exports = ProjectManager = {
             return callback(error)
             return callback(error)
           }
           }
           const jobs = []
           const jobs = []
-          for (const doc_id of Array.from(doc_ids || [])) {
+          for (const doc_id of doc_ids) {
             ;((doc_id) =>
             ;((doc_id) =>
               jobs.push((
               jobs.push((
                 cb // get the doc lines from redis
                 cb // get the doc lines from redis
@@ -298,7 +297,7 @@ module.exports = ProjectManager = {
     const timer = new Metrics.Timer('projectManager.updateProject')
     const timer = new Metrics.Timer('projectManager.updateProject')
     const callback = function (...args) {
     const callback = function (...args) {
       timer.done()
       timer.done()
-      return _callback(...Array.from(args || []))
+      return _callback(...args)
     }
     }
 
 
     const project_version = version
     const project_version = version
@@ -389,5 +388,5 @@ module.exports = ProjectManager = {
         return callback()
         return callback()
       })
       })
     })
     })
-  }
+  },
 }
 }