Guest User

Untitled

a guest
Sep 12th, 2020
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = function (inputData, inputDictionary) {
  2.   const dict = new Set(inputDictionary);
  3.  
  4.   if (inputData.every(d => dict.has(d.text))) {
  5.     inputData.sort((d1, d2) => d1.geometry[0] - d2.geometry[0]);
  6.     return inputData.map(d => d.text).join(' ');
  7.   }
  8.   return "Unreadable message";
  9. }
  10.  
  11. ////////////////////////////////////////////////////////////////////////
  12.  
  13. module.exports = function (inputData, inputDictionary) {
  14.   const dict = new Set(inputDictionary);
  15.  
  16.   inputData.sort((d1, d2) => d1.geometry[0] - d2.geometry[0]);
  17.   if (inputData.every(d => dict.has(d.text))) {
  18.     return inputData.map(d => d.text).join(' ');
  19.   }
  20.   return "Unreadable message";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment