Parcourir la source

decaf cleanup: remove unnecessary use of Array.from

GitOrigin-RevId: 78c835929c9d7c38e0231f8fbb3e16a35efb7498
Tim Alby il y a 4 ans
Parent
commit
291f28a655

+ 3 - 12
services/chat/app/js/Features/Messages/MessageFormatter.js

@@ -1,10 +1,3 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS101: Remove unnecessary use of Array.from
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
 let MessageFormatter
 module.exports = MessageFormatter = {
   formatMessageForClientSide(message) {
@@ -25,15 +18,13 @@ module.exports = MessageFormatter = {
   },
 
   formatMessagesForClientSide(messages) {
-    return Array.from(messages).map(message =>
-      this.formatMessageForClientSide(message)
-    )
+    return messages.map(message => this.formatMessageForClientSide(message))
   },
 
   groupMessagesByThreads(rooms, messages) {
     let room, thread
     const roomsById = {}
-    for (room of Array.from(rooms)) {
+    for (room of rooms) {
       roomsById[room._id.toString()] = room
     }
 
@@ -54,7 +45,7 @@ module.exports = MessageFormatter = {
       }
     }
 
-    for (const message of Array.from(messages)) {
+    for (const message of messages) {
       room = roomsById[message.room_id.toString()]
       if (room) {
         thread = getThread(room)

+ 1 - 8
services/chat/test/acceptance/js/helpers/ChatApp.js

@@ -1,10 +1,3 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS101: Remove unnecessary use of Array.from
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
 const { waitForDb } = require('../../../../app/js/mongodb')
 const app = require('../../../../app')
 
@@ -29,7 +22,7 @@ module.exports = {
           throw error
         }
         this.running = true
-        for (callback of Array.from(this.callbacks)) {
+        for (callback of this.callbacks) {
           callback()
         }
       })