-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js.map
1 lines (1 loc) · 12 KB
/
index.js.map
1
{"version":3,"sources":["src/index.js"],"names":["insertCommaAfterTwoChars","str","replace","removeDots","selectArrayInterval","arr","initial","final","arrAux","i","push","mountJSON","html","type","arrData","result","$","cheerio","load","text","split","length","Promise","resolve","JSON","stringify","err","errCode","e","reject","numberRaffle","locationRaffle","unorNumbers","orderedNumbers","date","totalCollection","isAccumulated","parseInt","sena","winners","prizeByWinner","quina","quadra","nextRaffle","estimatedPrize","accumulated","accumulatedMegavirada","join","terno","duque","accumulatedSaoJoao","acertos15","acertos14","acertos13","acertos12","acertos11","require","rp","Object","defineProperty","exports","value","resultByNumber","number","jar","encoding","error"],"mappings":"6eAOA,QAASA,CAAAA,CAAT,CAAmCC,CAAnC,CAAwC,CACtC,MAAOA,CAAAA,CAAG,CAACC,OAAJ,CAAY,uBAAZ,CAAqC,GAArC,CACR,CAED,QAASC,CAAAA,CAAT,CAAqBF,CAArB,CAA0B,CACxB,MAAOA,CAAAA,CAAG,CAACC,OAAJ,CAAY,KAAZ,CAAmB,EAAnB,CACR,CAED,QAASE,CAAAA,CAAT,CAA8BC,CAA9B,CAAmCC,CAAnC,CAA4CC,CAA5C,CAAmD,CACjD,KAAMC,CAAAA,CAAM,CAAG,EAAf,CACA,IAAK,GAAIC,CAAAA,CAAC,CAAGH,CAAO,CAAG,CAAvB,CAA0BG,CAAC,EAAIF,CAAK,CAAG,CAAvC,CAA0CE,CAAC,EAA3C,CACED,CAAM,CAACE,IAAP,CAAYL,CAAG,CAACI,CAAD,CAAf,EAEF,MAAOD,CAAAA,CACR,C,QAEcG,CAAAA,C,kCA2If;wBA3IA,UAA0BC,CAA1B,CAAgCC,CAAhC,CAAsC,CACpC;AADoC,GAGhCC,CAAAA,CAHgC,CAIhCC,CAJgC,CAEhCC,CAAC,CAAGC,CAAO,CAACC,IAAR,CAAaN,CAAb,CAF4B,CAMpC,GAAyC,CAArC,CAAAI,CAAC,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ise')\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n})\n\nfunction insertCommaAfterTwoChars (str) {\n return str.replace(/\\B(?=(\\d{2})+(?!\\d))/g, ',')\n}\n\nfunction removeDots (str) {\n return str.replace(/\\./g, '')\n}\n\nfunction selectArrayInterval (arr, initial, final) {\n const arrAux = []\n for (let i = initial - 1; i <= final - 1; i++) {\n arrAux.push(arr[i])\n }\n return arrAux\n}\n\nasync function mountJSON (html, type) {\n // eslint-disable-next-line prefer-const\n let $ = cheerio.load(html)\n let arrData\n let result\n\n if ($('body').text().split('|').length < 4) {\n return Promise.resolve(JSON.stringify({ err: 'Resultado não disponivel!', errCode: 1 }))\n }\n\n try {\n arrData = $('body').text().split('|')\n } catch (e) {\n return Promise.reject(JSON.stringify(e))\n }\n\n if (type === 'megasena') {\n try {\n result = {\n numberRaffle: arrData[0],\n locationRaffle: `${arrData[14]},${arrData[12]},${arrData[13]}`,\n unorNumbers: insertCommaAfterTwoChars(arrData[2]),\n orderedNumbers: insertCommaAfterTwoChars(arrData[20]),\n date: arrData[11],\n totalCollection: arrData[24],\n // eslint-disable-next-line radix\n isAccumulated: parseInt(arrData[3]) === 0,\n sena: {\n winners: removeDots(arrData[3]),\n prizeByWinner: arrData[4]\n },\n quina: {\n winners: removeDots(arrData[5]),\n prizeByWinner: arrData[6]\n },\n quadra: {\n winners: removeDots(arrData[7]),\n prizeByWinner: arrData[8]\n },\n nextRaffle: {\n date: arrData[22],\n estimatedPrize: arrData[21],\n accumulated: arrData[1]\n },\n accumulatedMegavirada: arrData[23]\n // eslint-disable-next-line semi\n }\n } catch (e) {\n return Promise.reject(JSON.stringify(e))\n }\n }\n if (type === 'quina') {\n try {\n // console.log(arrData)\n result = {\n numberRaffle: arrData[0],\n locationRaffle: `${arrData[4]},${arrData[2]},${arrData[3]}`,\n unorNumbers: selectArrayInterval(insertCommaAfterTwoChars(arrData[14]).split(','), 1, 5).join(','),\n orderedNumbers: selectArrayInterval(insertCommaAfterTwoChars(arrData[14]).split(','), 6, 10).join(','),\n date: arrData[16],\n totalCollection: arrData[20],\n // eslint-disable-next-line radix\n isAccumulated: parseInt(arrData[6]) === 0,\n quina: {\n winners: removeDots(arrData[6]),\n prizeByWinner: arrData[7]\n },\n quadra: {\n winners: removeDots(arrData[8]),\n prizeByWinner: arrData[9]\n },\n terno: {\n winners: removeDots(arrData[10]),\n prizeByWinner: arrData[11]\n },\n duque: {\n winners: removeDots(arrData[23]),\n prizeByWinner: arrData[22]\n },\n nextRaffle: {\n date: arrData[18],\n estimatedPrize: arrData[17],\n accumulated: arrData[13]\n },\n accumulatedSaoJoao: arrData[21]\n // eslint-disable-next-line semi\n }\n } catch (e) {\n return Promise.reject(JSON.stringify(e))\n }\n }\n\n if (type === 'lotofacil') {\n try {\n // console.log(arrData, arrData.length)\n result = {\n numberRaffle: arrData[0],\n locationRaffle: `${arrData[31]},${arrData[32]},${arrData[33]}`,\n unorNumbers: selectArrayInterval(arrData, 39, 53).join(','),\n orderedNumbers: selectArrayInterval(arrData, 4, 18).join(','),\n date: arrData[34],\n totalCollection: arrData[55],\n // eslint-disable-next-line radix\n isAccumulated: parseInt(arrData[18]) === 0,\n acertos15: {\n winners: removeDots(arrData[18]),\n prizeByWinner: arrData[19]\n },\n acertos14: {\n winners: removeDots(arrData[20]),\n prizeByWinner: arrData[21]\n },\n acertos13: {\n winners: removeDots(arrData[22]),\n prizeByWinner: arrData[23]\n },\n acertos12: {\n winners: removeDots(arrData[24]),\n prizeByWinner: arrData[25]\n },\n acertos11: {\n winners: removeDots(arrData[26]),\n prizeByWinner: arrData[27]\n },\n nextRaffle: {\n date: arrData[54],\n estimatedPrize: arrData[53],\n accumulated: arrData[56]\n }\n // eslint-disable-next-line semi\n }\n } catch (e) {\n return Promise.reject(JSON.stringify(e))\n }\n }\n\n return Promise.resolve(result)\n}\n\n// eslint-disable-next-line func-names\nexports.resultByNumber = async function (type, number) {\n let html\n if (number === undefined) {\n try {\n html = await rp(`http://www1.caixa.gov.br/loterias/loterias/${type}/${type}_pesquisa_new.asp`, {\n jar: true,\n encoding: 'binary'\n })\n return await mountJSON(html, type)\n } catch (err) {\n return Promise.reject(JSON.stringify(err.error))\n }\n } else {\n try {\n html = await rp(`http://www1.caixa.gov.br/loterias/loterias/${type}/${type}_pesquisa_new.asp?submeteu=sim&opcao=concurso&txtConcurso=${number}`, {\n jar: true,\n encoding: 'binary'\n })\n return await mountJSON(html, type)\n } catch (err) {\n return Promise.reject(JSON.stringify(err.error))\n }\n }\n // eslint-disable-next-line semi\n}\n"],"file":"index.js"}