JSFiddle - React, Tailwind, and code Playground

by whelkaholism

HTML

<div id="t"></div>

JavaScript

function projectTimes(value) 
{
  var hash = {};
    
  var f_parsecell = function(s)
  {
    var stop = 10;
    var m;
      
    console.log(s);
      
    while((m = /[^\s]+:\s*(\d+)/.exec(s)) || (stop-- <= 0))
    {
        console.log([stop, m]);
    }
  };
  
  if(typeof(value) == 'object')
  {
    for(var i = 0; i < value.length; i++)
      f_parsecell(value[i][0]);
  }
  else
    f_parsecell(value);
    
  var res = [];
    
  for(var el in hash)
      res.push([el, hash[el]]);
    
   return res;
}

var a = [['Enbox: 2, TLT:3'], ['TLT:4']];
var res = projectTimes(a);

$('#t').html(JSON.stringify(res));