{"version":3,"sources":["../LuV.LUMAS.Services/scripts/JSONExtensions.ts"],"names":["json","JSON","unflatten","data","Object","Array","isArray","regex","resultholder","p","m","cur","prop","exec","flatten","result","recurse","i","l","length","isEmpty","exports","default"],"mappings":"yGAAA,IAAMA,EAAQC,KAEdD,EAAKE,UAAY,SAASC,GAEtB,GAAIC,OAAOD,KAAUA,GAAQE,MAAMC,QAAQH,GACvC,OAAOA,EACX,IAAII,EAAQ,4BACRC,EAAe,GACnB,IAAK,IAAIC,KAAKN,EAAM,CAIhB,IAHA,IAEIO,EAFAC,EAAMH,EACNI,EAAO,GAEJF,EAAIH,EAAMM,KAAKJ,IAClBE,EAAMA,EAAIC,KAAUD,EAAIC,GAASF,EAAE,GAAK,GAAK,IAC7CE,EAAOF,EAAE,IAAMA,EAAE,GAErBC,EAAIC,GAAQT,EAAKM,GAErB,OAAOD,EAAa,KAExBR,EAAKc,QAAU,SAASX,GACpB,IAAIY,EAAS,GAoBb,OAnBA,SAASC,EAASL,EAAKC,GACnB,GAAIR,OAAOO,KAASA,EAChBI,EAAOH,GAAQD,OACZ,GAAIN,MAAMC,QAAQK,GAAM,CAC1B,IAAI,IAAIM,EAAE,EAAGC,EAAEP,EAAIQ,OAAQF,EAAEC,EAAGD,IAC5BD,EAAQL,EAAIM,GAAIL,EAAO,IAAMK,EAAI,KAC7B,GAALC,IACAH,EAAOH,GAAQ,QAChB,CACH,IAAIQ,GAAU,EACd,IAAK,IAAIX,KAAKE,EACVS,GAAU,EACVJ,EAAQL,EAAIF,GAAIG,EAAOA,EAAK,IAAIH,EAAIA,GAEpCW,IACAL,EAAOH,GAAQ,KAG3BI,CAAQb,EAAM,IACPY,GAGXM,EAAAC,QAAetB","file":"JSONExtensions.js","sourcesContent":["const json = (JSON as any);\r\n\r\njson.unflatten = function(data) {\r\n \"use strict\";\r\n if (Object(data) !== data || Array.isArray(data))\r\n return data;\r\n var regex = /\\.?([^.\\[\\]]+)|\\[(\\d+)\\]/g,\r\n resultholder = {};\r\n for (var p in data) {\r\n var cur = resultholder,\r\n prop = \"\",\r\n m;\r\n while (m = regex.exec(p)) {\r\n cur = cur[prop] || (cur[prop] = (m[2] ? [] : {}));\r\n prop = m[2] || m[1];\r\n }\r\n cur[prop] = data[p];\r\n }\r\n return resultholder[\"\"];\r\n};\r\njson.flatten = function(data) {\r\n var result = {};\r\n function recurse (cur, prop) {\r\n if (Object(cur) !== cur) {\r\n result[prop] = cur;\r\n } else if (Array.isArray(cur)) {\r\n for(var i=0, l=cur.length; i