'use strict';

const { sortArray } = require('../../../../../utilities');

const deleteMany = function ({ collection, deletedIds }) {
  const indexes = Object.entries(collection)
    .filter(([, model]) => deletedIds.includes(model.id))
    .map(([index]) => index);
  const sortedIndexes = sortArray(indexes);
  const data = sortedIndexes
    // eslint-disable-next-line fp/no-mutating-methods
    .map((index, count) => collection.splice(index - count, 1)[0]);
  return { data };
};

module.exports = {
  delete: deleteMany,
};

@@ -12,68 +12,8 @@
 ';%0A%0A
-const %7B sortArray %7D = require('../../../../../utilities');%0A%0A
 cons
@@ -75,23 +75,20 @@
   const 
-indexes
+data
  = Objec
@@ -171,111 +171,8 @@
 d))%0A
-    .map((%5Bindex%5D) =%3E index);%0A  const sortedIndexes = sortArray(indexes);%0A  const data = sortedIndexes%0A
     
@@ -232,21 +232,23 @@
   .map((
+%5B
 index
+%5D
 , count)

Simplify delete command for memory adapter